Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67648 invoked from network); 20 Sep 2017 17:25:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2017 17:25:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=ilija.tovilo@me.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ilija.tovilo@me.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain me.com designates 17.142.194.252 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.142.194.252 pv33p00im-asmtp003.me.com Received: from [17.142.194.252] ([17.142.194.252:44709] helo=pv33p00im-asmtp003.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/3A-62331-C94A2C95 for ; Wed, 20 Sep 2017 13:25:49 -0400 Received: from process-dkim-sign-daemon.pv33p00im-asmtp003.me.com by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OWL00D009BZ8A00@pv33p00im-asmtp003.me.com> for internals@lists.php.net; Wed, 20 Sep 2017 17:25:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1505928327; bh=3PG2ljWCqM8muCAo3xpetOG+z8N6DmRzzsTJXANADK0=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=uMQyCqjCiK+N1PhCH/iKCZ6Hc/L/gOltyUXkimzbCk5bfTqNyCreVhLnKuCFZQElA jHs5kvw9jwZdhXQYKMkNK++hMo2dbU105PaAPfP0cyf95lxniGtzeoCWcPChagvaM7 msih9pKiS/kgv1upAy5GJgqjB2UsqQ0whK2yP962Bby53LfWv3oMOdMc1t3HErYmxq B7VmXafZ0ruHPF8ivWaKLF+EEhkD4Dc3vK/9eA2/wqJG1qH4IlfO/NMi+i/BYthmYI JaCldehJpjEZ3ErcKnB1LMAv5RZxIcAGG2ZDxdOUO2uxLx3XPP3pudZJ8MNfTwIx+5 +JxX9Hbm/eXkQ== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp003.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OWL00H3K9QCQR30@pv33p00im-asmtp003.me.com>; Wed, 20 Sep 2017 17:25:27 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-20_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=72 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709200236 Date: Wed, 20 Sep 2017 19:23:23 +0200 To: internals@lists.php.net, "=?utf-8?Q?lists=40rhsoft.net?=" Message-ID: <75c3c518-56db-4887-99c7-32685e6e5f76@Spark> In-reply-to: References: <0040eda1-f2d4-408e-a3e1-fe3daf756dfd@Spark> X-Readdle-Message-ID: 75c3c518-56db-4887-99c7-32685e6e5f76@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=59c2a480_643c9869_aedc Subject: Re: [PHP-DEV] [RFC] Consistent null behaviour From: ilija.tovilo@me.com --59c2a480_643c9869_aedc Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I realized after sending the initial E-Mail that there might be more brea= king changes than I thought, like the one you suggested. The same thing actually happens for bools, ints and floats: https://3v4l.org/jvVbO I wouldn=E2=80=99t depend on this behaviour since you=E2=80=99d get error= s depending on what is returned, like an empty array, a string, an object= or resource. Regards On 20 Sep 2017, 19:18 +0200, lists=40rhsoft.net , wro= te: > > > Am 20.09.2017 um 19:06 schrieb ilija.tovilo=40me.com: > > Hi everybody=21 > > > > To my surprise, I noticed today that an array access on a =60null=60 = value returns =60null=60 without any warning whatsoever. > > Accessing the property of a =60null=60 value gives you a notice, whil= e calling a function on that =60null=60 value gives you a fatal error. > > > > https://3v4l.org/ZSZHN > > > > This is pretty inconsistent. IMO all of these should be fatal errors,= although I realize that might be a bit drastic for PHP 8. > > We should at least give the user a notice when using array access on = a =60null=60 value. > > > > Any thoughts=3F > wouldn't that break code like below which is IMHO the best usecase of > the PHP 5.6 feature that you can directly access a array field of a > function result and the type-casting encsues that the return-type is > always int > > function GetSKatMaxSort(int =24archive=3D0): int > =7B > return (int)mysqli=5Ffetch=5Frow(=24this->db->query(=22select SQL=5FNO=5F= CACHE > max(ssort) from =7B=24this->db->table=7D where sarchive=3D=24archive=22= , 1))=5B0=5D; > =7D > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --59c2a480_643c9869_aedc--