Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24149 invoked from network); 17 Sep 2015 12:42:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2015 12:42:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=terry@terah.com.au; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=terry@terah.com.au; sender-id=pass Received-SPF: pass (pb1.pair.com: domain terah.com.au designates 209.85.160.172 as permitted sender) X-PHP-List-Original-Sender: terry@terah.com.au X-Host-Fingerprint: 209.85.160.172 mail-yk0-f172.google.com Received: from [209.85.160.172] ([209.85.160.172:32865] helo=mail-yk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/53-33947-235BAF55 for ; Thu, 17 Sep 2015 08:42:27 -0400 Received: by ykft14 with SMTP id t14so15244812ykf.0 for ; Thu, 17 Sep 2015 05:42:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc:content-type; bh=Sg184JrNd+qVBhLOC8xh1e8hU8zLak422Ruk/TO6e10=; b=MgtLAT0ruoiDr0+rcJsaojL1H61+wcVaKejBZ54jGvsbEzZkVilEKiYyUCY2AVDhnJ nKkZp2OdwjsBIXtaAucamHeIIBm8Ezf8XjmZ9vjRxHhYVK5N4Xh1/VApZYLBxM9tvRvI Dvl0Qi+PCqYdctCQn4cj5+2P9Q2OLRNLJsiJcaTFYI0lA5dpjGexRk0If+JBUlCS2trq BQLcethmnChuASzbm1Oaoq9htTFpmNZ//fm/NQcBMRvlGp2ehpV4QhiqxCSdEWSAQY2X 6NCmwQfXbYz0TALszpJtroJA+4USXJ6i6RxJ/SniYbzDsQwO26imv8G5+JHKqLLn2dmz k+LQ== X-Gm-Message-State: ALoCoQl5QWjknlDCNHD8J3EA+zaVW5VGoWPpUbktA3idgZiSjW5zl/P46YmfHUIbGzpD/it0aaSH X-Received: by 10.129.90.214 with SMTP id o205mr32435564ywb.32.1442493742729; Thu, 17 Sep 2015 05:42:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.215.197 with HTTP; Thu, 17 Sep 2015 05:41:52 -0700 (PDT) X-Originating-IP: [101.165.94.3] In-Reply-To: References: <1F615BCD-1B9B-4C51-A210-869F1AA1F6E3@craigfrancis.co.uk> <55E5EBBF.6020803@gmail.com> <0BA3A129-D356-4781-B6DE-E2B5A7924AE2@craigfrancis.co.uk> <55E6EC36.6090301@gmail.com> <9AF329EC-99A5-412D-A52B-432627A5520F@gmail.com> <6F4D91EE-B56E-4B83-B1AF-598C3F6897FC@craigfrancis.co.uk> <55F07BA4.2000204@gmail.com> <55F6B911.9080400@gmail.com> <96BE7F01-D04B-483B-B1A3-B45CED6DFCDC@craigfrancis.co.uk> <55F6F08C.1020506@gmail.com> <0BEF6D82-CB5F-49F6-A3A4-3267924A0CDA@thesba.com> <55F72CA9.2060301@gmail.com> <09369945-76FE-4E08-9C2C-15FB0577AD27@thesba.com> <55F752E7.9070801@gmail.com> <55F9B4C7.3050700@gmail.com> <440C64A2-4B4F-4AEF-ACE3-F3A6637EBAB6@thesba.com> <55F9E5E7.3030408@gmail.com> <711C7F58-6187-4ED2-8314-EB217DF0EC2B@thesba.com> Date: Thu, 17 Sep 2015 22:41:52 +1000 Message-ID: Cc: internals Content-Type: multipart/alternative; boundary=001a114914b4207f81051ff0bfc5 Subject: Re: [PHP-DEV] PHP 7.1 - Address PHPSadness #28? From: terry@terah.com.au (Terry Cullen) --001a114914b4207f81051ff0bfc5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, On 17 September 2015 at 19:01, Rowan Collins wrote: > On 17 September 2015 02:17:59 BST, Robert Williams > wrote: > > An unset variable is not null. Rather, it=E2=80=99s > >completely undefined, and PHP yells at you for just that reason if you > >try to access it. Then, it turns around and tries to appease you by > >giving you null. > > > I see it as rather the other way around: it happily gives you a null, but > then says "oh, by the way, you never actually initialised that variable t= o > null". Not an error, just a friendly aside. > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Here is an example where exists would be useful; // input is {name:'Ted', birth_dt: null} $input =3D json_decode(file_get_contents('php://input')); // I should have used property_exists() instead of isset().. wasn't expecting a null.. if ( isset($input->birth_dt) && ! isValidBirthDate($input->birth_dt) ) { throw new Exception('Bad birth date'); } saveToDb($input); // Oh no... I clobbered birth date =E2=80=8BTerry=E2=80=8B --001a114914b4207f81051ff0bfc5--