Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51780 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3688 invoked from network); 31 Mar 2011 22:46:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 22:46:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.138.91.72 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mail_ben_schmidt@yahoo.com.au X-Host-Fingerprint: 98.138.91.72 nm10-vm0.bullet.mail.ne1.yahoo.com Received: from [98.138.91.72] ([98.138.91.72:32287] helo=nm10-vm0.bullet.mail.ne1.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/91-28342-A34059D4 for ; Thu, 31 Mar 2011 17:46:18 -0500 Received: from [98.138.90.57] by nm10.bullet.mail.ne1.yahoo.com with NNFMP; 31 Mar 2011 22:46:15 -0000 Received: from [98.138.87.11] by tm10.bullet.mail.ne1.yahoo.com with NNFMP; 31 Mar 2011 22:46:15 -0000 Received: from [127.0.0.1] by omp1011.mail.ne1.yahoo.com with NNFMP; 31 Mar 2011 22:46:15 -0000 X-Yahoo-Newman-Id: 814569.42876.bm@omp1011.mail.ne1.yahoo.com Received: (qmail 74061 invoked from network); 31 Mar 2011 22:46:15 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Jc480O65eNuWoDD/ypnjggZwrvGedM1FtIHdjgNtTDaM2wN+NnEscVmhGaVnvFy+dsF7/UGHMnkjZaudsEicO5G3z56hUua4u2IOLOVFvLvA4iyhGC9jzuwxQQTfysSd/zboU1P4CxgKLbEIOwWU/1+XLAgAnO9khT4NhCOy0lo= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1301611575; bh=9JaRY9MiDgPzhza+4GtffKDulr3kXFQNU+MYUQ6wZCM=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=lbE8g9IedXMj81eRCbwlW5Dfx1ivzrGYkKUT7dQzHn5IJpSsWWwwKDP2xSjc3T5UIWIByXK+BHukRrlGcm7Ynhaw9fr/peGoj0A5k3afMILvx+r7/l8D5syOHRlcKMWrhfcr5r4ieTgMkg69jGZjxcmwx1i6sTM3W8xzotMnTC0= Received: from thought.local (mail_ben_schmidt@203.217.77.103 with plain) by smtp145.mail.mud.yahoo.com with SMTP; 31 Mar 2011 15:46:15 -0700 PDT X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: QF2GnWMVM1mCauILyI.ri88fUEd5qtR2dhV9OzUGlsJxVUN a2P26PA7vZ8x_63R4AxKvDiZIzAN5XUKcxw50oKn4Jw.uS0akegnWYNCdGhS _65LYfOjFiaUoOlzHLMvTiupWQceAxYoZGg4y5mcSK_akXGVJeEzU2SyMMZP aQruPh0rH9ETkub8AcySXhJecGdYKeSi9DCyV42RxfirEWDMk2vW4QE41OK7 WH0ea15vscAEgE8DwhYV7ap6iPo8rhXbhCcytSk9y_LbxDoeMvgzdNZX6PSX qMkyO9uMaoTvGDztRw0Inl8949BWQK3F2Kj1ZuZQgpTks1odPHZERW.6EswU iP9O140CI9FavucWE34_lb7wtuw-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4D950434.3060704@yahoo.com.au> Date: Fri, 01 Apr 2011 09:46:12 +1100 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: David Coallier CC: internals References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) On 1/04/11 3:29 AM, David Coallier wrote: > Hey there, > > I've been working on a little patch that will allow variables ($1) in > a short-ternary operation to go through an implicit isset > (zend_do_isset_or_isempty) check so that the average use-case for the > short-ternary operator doesn't yield in a notice whenever the first > variable of the expression isn't set. > > So the use-case I'm considering is the following: > > $list = array('name' => 'list'); > > echo $list['name'] ?: 'List not set.' . PHP_EOL; > echo $list['name-notset'] ?: 'List not set.' . PHP_EOL; > ?> > > This example, which we all know, will result in a notice for the > second echo statement because the requested array-key doesn't actually > exist in the array. I'm not familiar with the construct, but to be honest, I fail to see how it is useful without the suppression of the notice. I mean, it's a shorthand for isset($var)?$var:$something_else isn't it? That presupposes that $var may not be set, but that you've accounted for that fact, so don't want a notice about it. Obviously the isset() can only be applied if the 'left hand side' is an lval, but I think it makes sense to apply it whenever it is an lval. So a big +1 from me. Ben.