Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91460 invoked from network); 6 Mar 2015 14:36:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2015 14:36:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=patrickallaert@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.179 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 74.125.82.179 mail-we0-f179.google.com Received: from [74.125.82.179] ([74.125.82.179:37534] helo=mail-we0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/21-16282-08BB9F45 for ; Fri, 06 Mar 2015 09:36:48 -0500 Received: by wesx3 with SMTP id x3so13218802wes.4 for ; Fri, 06 Mar 2015 06:36:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:references:from:date:message-id:subject:to :content-type; bh=se5D0uYFm2tkyYKKqtePGIytQyMoZrszFWPkarUy9KI=; b=Ml6DqK9IrkfC7WWpPDH9oIRBjNtm0tTu4eDUhI3lEYXZ64TYFE3EZmMacvRMNQJbmA AuY+I+/ABciT2NpFU8VmzGmIDVrZCgQ6rwYiXt9tWNozBGRNYSKlD8vuYydDf78FbEQy OF+UN28UCx/nhFsEY/QIWh4D+Qzhop3yANDYvcUlV054PjLQ5Nbsen7DjdmYSZMjFO9H 276KhDwyjvbJ7XKhHmbPk7W/JerCjl+xklzGOED0hKa/oErnV1/XrVVjJ8qUK01onNb2 UyqZTCSxKu9SI6HX2x4SHTK4RxyDykG3064e0YuD13DnRTUx26rp+Y4RIqVDRo8Q/x7l 6Aig== X-Received: by 10.180.80.230 with SMTP id u6mr76820268wix.69.1425652604414; Fri, 06 Mar 2015 06:36:44 -0800 (PST) MIME-Version: 1.0 References: <075201d04f82$abd721d0$03856570$@php.net> <54F8D69B.6000704@pascal-martin.fr> Date: Fri, 06 Mar 2015 14:36:43 +0000 Message-ID: To: "Pascal Martin, AFUP" , internals@lists.php.net Content-Type: multipart/alternative; boundary=f46d04428ace0f32f205109f9df0 Subject: Re: [PHP-DEV] [RFC][VOTE] Improve array to string conversion From: patrickallaert@php.net (Patrick ALLAERT) --f46d04428ace0f32f205109f9df0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Le jeu. 5 mars 2015 =C3=A0 23:20, Pascal Martin, AFUP a =C3=A9crit : > Le 23/02/2015 17:06, Fran=C3=A7ois Laupretre a =C3=A9crit : > > Starting the vote for https://wiki.php.net/rfc/array-to-string. > > Hi, > > We talked about this with other people at AFUP and a great majority of > us agrees that the current behavior of array to strings conversions is > not quite useful Nor are all the following operations: $useOfUnexistingVariableIsOkToContinueExecution =3D $variableNotSet; $obj =3D new stdClass(); $useOfUnexistingPropertyIsOkToContinueExecution =3D $obj->notFound; $computingWithObjectIsOkToContinueExecution =3D 42 + new stdClass(); $array =3D array(42); $useOfUnexistingOffsetIsOkToContinueExecution =3D $array[42]; $int =3D 42; $usingANumberAsAnArrayIsFineNoNotice =3D $int["foo"]; $null =3D NULL; $usingANonObjectAsAnObjectIsOkToContinueExecution =3D $null->notAnObject; $resource =3D fopen("/etc/hosts", "r"); $resourceToStringConversionIsOkToContinueExecution =3D (string) $resource; Running the above would produce: PHP Notice: Undefined variable: variableNotSet in - on line 2 Notice: Undefined variable: variableNotSet in - on line 2 PHP Notice: Undefined property: stdClass::$notFound in - on line 5 Notice: Undefined property: stdClass::$notFound in - on line 5 PHP Notice: Object of class stdClass could not be converted to int in - on line 7 Notice: Object of class stdClass could not be converted to int in - on line 7 PHP Notice: Undefined offset: 42 in - on line 10 Notice: Undefined offset: 42 in - on line 10 PHP Notice: Trying to get property of non-object in - on line 16 Notice: Trying to get property of non-object in - on line 16 -- and, for several of us, when we started getting > notices with PHP 5.4, it actually showed us there were bugs in our > applications. > Which confirms that turning notices 'On' would allow anyone to fix code that may seems suspect. > So, we are +1 on this. > > Basically, even if notices are already bringing some useful information, > we feel being more "strict" and "explicit" than that might help, here. > Why suddenly changing that specific notice, without deprecation, to one that stop the execution and without "opt-in" for it? (and according to the patch, only in some "array to string conversion", not all?) I'm about to post another suggestion in a fork of this discussion which might fit anyone, stay tuned! Cheers, Patrick --f46d04428ace0f32f205109f9df0--