Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108227 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5740 invoked from network); 24 Jan 2020 17:06:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Jan 2020 17:06:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0DCB0180531 for ; Fri, 24 Jan 2020 07:16:22 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FREEMAIL_REPLY, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 24 Jan 2020 07:16:21 -0800 (PST) Received: by mail-oi1-f196.google.com with SMTP id k4so2147669oik.2 for ; Fri, 24 Jan 2020 07:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1VCUeMieFJ/5KI5atFEGpHhV9sDg8GBoi5U61ir6mp4=; b=EkS/3RMJKogah2UnuDeE//Zb5MB4VenCkkFvA2hfcSv0mCW2D3DBDIQCu7/DVUCBmo f51LJSq/qw3d8+RxPb+Z/eQcQ2A3/Ot72QLxHnYrNUhOTkt6CXl0AfUKoBxvd6SRj/nx w3N37/0gak6O2/BLvFz61lpiv7ZesyLhzQLYEznmPwyA27LW1a1zXKSNGVlaXJDMy4VH aj2rIIR2P52a7pDebwAkgOk5wJu0EBavUoNr46l0j6OtEJTnoEwWB676HrRM1OnOHe6T Ea3Ke230RhF98zbGDYjhRFfT039XQRxAk2ebJkalOODgSQLQX91S043Kzelf9p1jnFyk 2xsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=1VCUeMieFJ/5KI5atFEGpHhV9sDg8GBoi5U61ir6mp4=; b=WzumJ4fy45t4cHE5mxH0EVtd4+qRDGS6o/1AEEJFROhlbC2TOxwU7GaWSJeG6T/VNp ElI5fCxe22bwrtXsc5bbJ3ovrjg1SDkhQzXmv2q4gfSTIKloux1scoNlV07igaoNoRkL v+5N50rkRcVL2gmZ3ibljBhljxCd2UIqBNdiVfptodHyd9x3pozCtlt/mceuSE7l129K 8d5kdjRjyLJ3A3ter5dB4/CI+6Gop/4cZOYK9xQvh6OIQNH+KiHdSHddJFF4dOnLnEHd 09NWr1qOxjRtzfJy2ygJsvqmgU6HxYJgYnCFZFAm/IbBvnuwuu7m6k6la+B60AJXSXiE dPkg== X-Gm-Message-State: APjAAAU241WOQDxWV2Q9ZxDxlsH+Osfrrz4rMcdAoTsIN930mHZNmboF UD6XRWAgseesMwbTqxDENAMwm/SsDzpMOYYoNzk= X-Google-Smtp-Source: APXvYqzABRAUB0UaLQAf4o2VS5SVieeMTXSbKzK6SabgmSWTNLMmC58mrjfLvWg1wG+aMpKJFKmf4l1FtLTU1aIaoWw= X-Received: by 2002:aca:a997:: with SMTP id s145mr2325675oie.71.1579878980211; Fri, 24 Jan 2020 07:16:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 24 Jan 2020 16:16:08 +0100 Message-ID: To: Rowan Tommins , PHP Internals List Content-Type: multipart/alternative; boundary="000000000000675739059ce43de7" Subject: Re: [PHP-DEV] [RFC] Adding a "Stringable" interface to PHP 8 From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000675739059ce43de7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le mer. 22 janv. 2020 =C3=A0 20:03, Rowan Tommins = a =C3=A9crit : > On Wed, 22 Jan 2020 at 15:47, Nicolas Grekas > > wrote: > > > Hello everyone, > > > > as announced last week, I'm officially opening a discussion for adding = a > > "Stringable" interface to PHP 8. > > > > The RFC and its rationale are presented here as required: > > https://wiki.php.net/rfc/stringable > > > > > I'm still unconvinced on this one, but I was digging into some of the use= s > you linked to, to understand why it might be used. > > The background to the Symfony Validator one makes for some interesting > reading: https://github.com/symfony/symfony/pull/31083 and > https://www.drupal.org/project/drupal/issues/3029540 > > It seems that Symfony always intended this particular parameter to be a > string, but couldn't enforce that until PHP 7; Drupal abused it by passin= g > in an object, which happens to be stringable but have special behaviour i= n > the templating layer, leading to a compatibility break between the two > projects. In a sense it's just luck that the object in question implement= s > __toString(), rather than being a completely unrelated object, since Drup= al > relies on it being passed back out unmodified. > > Nonetheless, it's an interesting use case, and it's interesting to > speculate whether it might have been designed how it is anyway without th= at > history. > Ultimately, the contract is that (string)$foo->getMessage() won't > error, which is ... kind of useful, I guess? > Totally, you got it right I think. Does the RFC trigger any other comments? Is the patch OK to people that know the engine well? I'll open the vote on February 6th there are no objections. Thank you, Nicolas --000000000000675739059ce43de7--