Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93556 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19674 invoked from network); 26 May 2016 10:16:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2016 10:16:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.164 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.164 mx208.easyname.com Received: from [212.232.25.164] ([212.232.25.164:50836] helo=mx208.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 12/60-17600-AFCC6475 for ; Thu, 26 May 2016 06:16:27 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1b5sKs-0002l5-9x; Thu, 26 May 2016 10:16:14 +0000 Reply-To: internals@lists.php.net References: <7B.12.14311.F79C5475@pb1.pair.com> <1b12b09f-f190-dca0-51d9-468e9c571268@fleshgrinder.com> <4ec823c6-b039-fc91-7c78-60d67719cd81@gmail.com> <00482771-3a07-06cf-ee8d-cd83a301c7e7@fleshgrinder.com> <1ac579b7-6bf3-f362-c045-0261abcfa17c@fleshgrinder.com> To: Rowan Collins , internals@lists.php.net Message-ID: <2f058fee-f230-739f-4ed5-ff7d0cabe924@fleshgrinder.com> Date: Thu, 26 May 2016 12:16:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sg95ck3uxGTWSihG8BinRRlsxBWiObGAP" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: php@fleshgrinder.com (Fleshgrinder) --sg95ck3uxGTWSihG8BinRRlsxBWiObGAP Content-Type: multipart/mixed; boundary="ax8hkRPGhoddlaGxdOS0kimHVCxkK3GET" From: Fleshgrinder Reply-To: internals@lists.php.net To: Rowan Collins , internals@lists.php.net Message-ID: <2f058fee-f230-739f-4ed5-ff7d0cabe924@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties References: <7B.12.14311.F79C5475@pb1.pair.com> <1b12b09f-f190-dca0-51d9-468e9c571268@fleshgrinder.com> <4ec823c6-b039-fc91-7c78-60d67719cd81@gmail.com> <00482771-3a07-06cf-ee8d-cd83a301c7e7@fleshgrinder.com> <1ac579b7-6bf3-f362-c045-0261abcfa17c@fleshgrinder.com> In-Reply-To: --ax8hkRPGhoddlaGxdOS0kimHVCxkK3GET Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/26/2016 12:03 PM, Rowan Collins wrote: > Could you summarise what your proposal actually is; I got a bit lost > with what your long list of examples was trying to show me. >=20 To summarize it: we should change the behavior of isset() to work exactly the same way as it does for associative array keys if they have null assigned to them. Shorter example of current PHP implementation: $a =3D ['x' =3D> null]; var_dump(isset($a['x'])); // false var_dump(array_key_exists($a, 'x')); // true $o =3D (object) ['x' =3D> null]; var_dump(isset($a->x)); // true var_dump(property_exists($a, 'x')); // true PHP 8 $o =3D (object) ['x' =3D> null]; var_dump(isset($a->x)); // false var_dump(property_exists($a, 'x')); // true This would actually be more consistent with the isset() behavior together with associative arrays and it would allow us to handle typed properties that where not initialized (as illustrated in the longer example). On 5/26/2016 12:03 PM, Rowan Collins wrote: > Can you provide a reference for that? The only thing mentioned in the > changelog in the manual is this rather rare situation: >=20 > $foo =3D 'a string'; > isset($foo['some_key']); >=20 > $foo['some_key'] doesn't actually have much of a meaning in that case, > anyway, and it has nothing to do with initialisation. > Just tested it with those ancient versions and you are right that I interpreted that sentence incorrectly. The behavior of isset() with array keys that were explicitly set to null never changed. ref: https://3v4l.org/TS621 However, this does not change my proposal. :) --=20 Richard "Fleshgrinder" Fussenegger --ax8hkRPGhoddlaGxdOS0kimHVCxkK3GET-- --sg95ck3uxGTWSihG8BinRRlsxBWiObGAP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXRszsAAoJEOKkKcqFPVVriMIQAIw4Stci6YzYzWUBHzqgkNLu iKaQw7gJyjkjXEDgIUs4fph8NexXOsyqgj18D4APnuQBTQyfjKEi2O2jWDVSCp8E WwIyyd8qQCvi+hViAXTLtc5FjrP3xuDZP09PSW22TKMGacpWWrTIes+kzW6KNjth 3Kll9bn6kVSO/3ly010gECDdsQc3OyAIZpUr2/6mas2P5LXvTWiX06flUDRDPeCw HnPHLbMdO0Cr7lllynAOrMoG6U7tkZBVhwByRGAhxAhV0Fe1vF8nepsbfsw4nhZJ wGQAqmqKhmPcXCRNYiDSI/hB4CIAt+PwwIebxHBQBrz9YueVw4lbW1Iq2CcNb++g qlYt2A1WS6k6ZvDe8NQ4YpJCnH7PYq6YKCuPSOnH+MBOW0fXP4wnY2lcKjkq0Vd1 VMGswyEoyrKMVTTxrXMGTXI/5Fjp8ex1QsLPpY+DkIZFiO8WaFOaz1Kq0dBNGi8z uHzBHihekWzjZ6DvXNwbelwg4/EzXjfCgZYuS3EXTSeK1GBnTTcpM7vf4qHLnlqP ttRCpYskGrFfW0vFn7ThmnFfa8uQusc2m8EPjKpvgjGxoiEnWeIlamv9Zkrvt4WK LL/Ip1Veu/eDVy5sMDPXEld/Gxms7ADR4YL3/jV8J9q5YmaSGc80Kgug2kLiydsc VSP5V1TUYF4BOXu2Rten =GmFL -----END PGP SIGNATURE----- --sg95ck3uxGTWSihG8BinRRlsxBWiObGAP--