Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83183 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11100 invoked from network); 19 Feb 2015 13:27:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2015 13:27:35 -0000 Authentication-Results: pb1.pair.com header.from=patrick.allaert@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.173 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 74.125.82.173 mail-we0-f173.google.com Received: from [74.125.82.173] ([74.125.82.173:38041] helo=mail-we0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/94-18870-6C4E5E45 for ; Thu, 19 Feb 2015 08:27:34 -0500 Received: by wesw55 with SMTP id w55so7297072wes.5 for ; Thu, 19 Feb 2015 05:27:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=YSf/rx8Cy+6TfLAw2UljHeWJ9cnuorjCsb8p4smlb/0=; b=EtZyQ6Nhg2CLqdgv38Sh2r48lGgJAB4pChYeDupI7nC7DFvKehyP1oXRyNtxniNUKd r2tEAs7o/xZi3RxGZ9ntFhIN2UHCv0XZZve12H3KVnyorASkdZoRxd6DS1c0uJXDTqi1 OgyfEWKGnwTu3d6x7RMy622hSsJT6HA2rPOtLfFuoe62EsHmFlq/Zyq2VUJ7CGJ804yS TPIbsBMvS4pKtD16asFbeGUbcboN3to0FltN7bDUbJwg3bsx5bI7cW2hbp5BFaOrsryZ vnHAQKivEHhl0zWgnrC3IcDgA75aGVLNHNBK+4m+CA9ayKJREt21x5/3nLgAGUTzK5rZ 4BNA== MIME-Version: 1.0 X-Received: by 10.180.211.206 with SMTP id ne14mr14789316wic.79.1424352451197; Thu, 19 Feb 2015 05:27:31 -0800 (PST) Sender: patrick.allaert@gmail.com Received: by 10.194.35.38 with HTTP; Thu, 19 Feb 2015 05:27:31 -0800 (PST) In-Reply-To: <042c01d04c36$edd61680$c9824380$@php.net> References: <03aa01d04bd3$f8330420$e8990c60$@php.net> <042c01d04c36$edd61680$c9824380$@php.net> Date: Thu, 19 Feb 2015 14:27:31 +0100 X-Google-Sender-Auth: 7YAClUgg7QHmxIETDVZ93DZFlYY Message-ID: To: francois@php.net Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: (off topic) Array to string conversion (Was: Re: [PHP-DEV] Scalar Type Hints v0.4) From: patrickallaert@php.net (Patrick ALLAERT) 2015-02-19 12:26 GMT+01:00 Fran=C3=A7ois Laupretre : > Hi Patrick, > > I know you didn=E2=80=99t decide it alone, but the right solution, IMO, w= ould have > been to E_DEPRECATE nonsense conversions. That=E2=80=99s what we are curr= ently doing > for ZPP conversions (https://wiki.php.net/rfc/zpp-conversion-rules). I al= so > proposed this for array to string (https://wiki.php.net/rfc/array-to-stri= ng) > but should probably extend it to other conversions that generate E_NOTICE= , > at least. For a new major version, it perfectly make sense and I am with you on refactoring this. Take into account that casting an object (without __toString() implementation) to string will generate an E_RECOVERABLE_ERROR (at one moment [1], it generated the string "Object"! That was quickly change to generate an error, but the array to string conversion did not benefit of the same change and survived much longer). As you suggest, I think it would be good to extend it to other conversions so that it might be unified a bit. [1] https://github.com/php/php-src/commit/da9faa2c3a7db0f222e751e899c843a1f= 6561e8b#diff-b09edfedd835ebc4491e565c147190e7R133 Thanks, Patrick