Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93558 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23681 invoked from network); 26 May 2016 10:49:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2016 10:49:44 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.84 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.84 mx103.easyname.com Received: from [77.244.243.84] ([77.244.243.84:37280] helo=mx202.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/31-17600-7C4D6475 for ; Thu, 26 May 2016 06:49:43 -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 1b5sr5-0005SX-5x; Thu, 26 May 2016 10:49:31 +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> <2f058fee-f230-739f-4ed5-ff7d0cabe924@fleshgrinder.com> <7c3f6b51-f93b-c69f-a592-7bb0a00586e6@gmail.com> To: Rowan Collins , internals@lists.php.net Message-ID: <528dd5dc-0e17-d766-a83f-02e2429277fa@fleshgrinder.com> Date: Thu, 26 May 2016 12:49:24 +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: <7c3f6b51-f93b-c69f-a592-7bb0a00586e6@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="E9ugFSBFDv3tEDq24qLFVXuKTBHm5A06f" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: php@fleshgrinder.com (Fleshgrinder) --E9ugFSBFDv3tEDq24qLFVXuKTBHm5A06f Content-Type: multipart/mixed; boundary="seDeHtKqOnaMwtQBxhEmc0t9aE5xAevxU" From: Fleshgrinder Reply-To: internals@lists.php.net To: Rowan Collins , internals@lists.php.net Message-ID: <528dd5dc-0e17-d766-a83f-02e2429277fa@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> <2f058fee-f230-739f-4ed5-ff7d0cabe924@fleshgrinder.com> <7c3f6b51-f93b-c69f-a592-7bb0a00586e6@gmail.com> In-Reply-To: <7c3f6b51-f93b-c69f-a592-7bb0a00586e6@gmail.com> --seDeHtKqOnaMwtQBxhEmc0t9aE5xAevxU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/26/2016 12:39 PM, Rowan Collins wrote: > On 26/05/2016 11:16, Fleshgrinder wrote: >> $o =3D (object) ['x' =3D> null]; >> var_dump(isset($a->x)); // false >> var_dump(property_exists($a, 'x')); // true >=20 > Apart from a typo in your example (you change from $o to $a), this is > already the current behaviour, and always has been: https://3v4l.org/Ne= qGl >=20 > isset() is really very simple: if the thing your accessing would give > you the value null, it returns false, otherwise it returns true. >=20 > Regards, Now I feel stupid but I guess I got lost myself. :P This means it is even simpler, we just have to add the E_NOTICE and be done with it. $g =3D new class { public $x; }; var_dump($g->x); // null + E_NOTICE Uninitialized var_dump(isset($g->x)); // false var_dump(property_exists($g, 'x')); // true var_dump(is_null($g->x)); // true + E_NOTICE Uninitialized var_dump($g->x =3D=3D null); // true + E_NOTICE Uninitializ= ed var_dump($g->x =3D=3D=3D null); // true + E_NOTICE Uninitial= ized This behavior would be true for all variations: class A { var $x; public $x; public int $x; public ?int $x; } No notice for the following: class A { var $x =3D null; public $x =3D null; public int $x =3D 0; public ?int $x =3D null; } --=20 Richard "Fleshgrinder" Fussenegger --seDeHtKqOnaMwtQBxhEmc0t9aE5xAevxU-- --E9ugFSBFDv3tEDq24qLFVXuKTBHm5A06f 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 iQIcBAEBCAAGBQJXRtS5AAoJEOKkKcqFPVVrqU8P/i4ObYWKU/SrxvPt/S4Gd72+ 2u2c9Ti3Up57km3rUb4dVRmobNf12/t+jgOUQlbTbCftI09Rol/LdBZ3le+Ros4i k7gheAKywisSX9aMVr7EsV+aIGiEIwkXu2UUulmOv7V+JuFX86bNZZ6eLjUrQDdG eHz8zaA/pJsknISwd2ggIn+PxuDjuwBxzuKfTcDtdxJKfmqsAl5hmd//RmI540Xn UcK7XHgVD2bJ/5AxcDeJxnvuy+wqazO995S52uej49QfU5I0LiqwYjOLmk/tw62B nOFqsYYAaqIUDfvQDNEBXcM8b2HhFA38utsWNipEqRvGOyuSuj1P0vDk/pYzyyqM GDbOfdSUD+aIjlDRxVH+sBvczqTgU0phEfIRfs59E7dMzQ8Zopks79YGGw5X8dS7 b4r3LZ59Jlo1RnFOXq5FalcLKyP4MqWgT6Qku/r0AWJ5jaT5uRJMJWJGQveSgM2P k/QypMeUn5ElpTOedtDHeDdq5KvafytGXxPTX8OW+TwbZB0zEimfCd/JufA4V720 QO25ckpj040hGi4e+17DzeyJcfUT2xS0RFlW4+ncGFOspI3asrUIiWZNssPDlZzh KAx1JjmxYtG3g2kWEgzX7cO+d0tgCHer1fkminr54QpKLK2WzBuW69pfzHG5hHq6 //E0bQ7jXyfdffOe7v6F =Aoug -----END PGP SIGNATURE----- --E9ugFSBFDv3tEDq24qLFVXuKTBHm5A06f--