Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34940 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73165 invoked by uid 1010); 26 Jan 2008 17:17:22 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73150 invoked from network); 26 Jan 2008 17:17:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jan 2008 17:17:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:36223] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/EE-08850-02B6B974 for ; Sat, 26 Jan 2008 12:17:20 -0500 Received: from 208-58-196-175.c3-0.slvr-ubr1.lnh-slvr.md.cable.rcn.com ([208.58.196.175]:50351 helo=[192.168.1.88]) by scottsdale.servershost.net with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1JIoed-00037I-Dx; Sat, 26 Jan 2008 11:17:19 -0600 To: Sebastian Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain Date: Sat, 26 Jan 2008 12:17:24 -0500 Message-ID: <1201367844.8418.4.camel@sams-room> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] ifsetor like expression in php6 From: sam@sambarrow.com (Sam Barrow) I don't think throwing a E_NOTICE is appropriate. The isset() construct doesn't throw an E_NOTICE, this shouldn't either. On Sat, 2008-01-26 at 17:30 +0100, Sebastian wrote: > hi, > > i just found the new ifsetor like construction in php6. It left me the > question why php has to throw an E_NOTICE when the variable is not set. This > is basicly because that actually is the meaning of this construction, > checking if the variable is set and if it isnt give back a standard value. > Of course i know this construction can be (mis)used with an Boolean check > ($var===$var2), but this does not make much sence either because TRUE will > then be assigned to the new variable if the expression evaluates to TRUE > (but please correct me if theres a real use for this). > > So in any case it would be better to remove the Boolean check feature and > make it a simple ifsetor() without the E_NOTICE again. > > For those of you who have not heard of it heres an example: > > > // If $_GET['foo'] is set, then its value will be assigned to $foo, > // otherwise 42 will be assigned to $foo. > > $foo = $_GET['foo'] ?: 42; > > ?> > > Greetings > > Sebastian >