Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41842 invoked from network); 6 Jan 2013 18:13:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2013 18:13:07 -0000 Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 67.200.53.250 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 67.200.53.250 mail.zerocue.com Received: from [67.200.53.250] ([67.200.53.250:58558] helo=mail.zerocue.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/55-04877-2BEB9E05 for ; Sun, 06 Jan 2013 13:13:07 -0500 Received: from [172.17.0.122] (unknown [66.25.151.173]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id 324DE12037B; Sun, 6 Jan 2013 18:13:04 +0000 (UTC) Message-ID: <50E9BEAD.9050300@zerocue.com> Date: Sun, 06 Jan 2013 12:13:01 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Stas Malyshev , Pierre Joye CC: "internals@lists.php.net" References: <508A68B9.1050801@zerocue.com> <508AA48D.5010903@sugarcrm.com> <508C1C4F.6060406@zerocue.com> <508D5726.8080200@zerocue.com> <508ED5A4.9010100@sugarcrm.com> <50909CDF.9090505@zerocue.com> In-Reply-To: <50909CDF.9090505@zerocue.com> Content-Type: multipart/alternative; boundary="------------000007050707030508050901" Subject: Re: [PHP-DEV] [RFC] Property Accessors v1.2 : isset / unset "failable" From: cpriest@zerocue.com (Clint Priest) --------------000007050707030508050901 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Bringing up this old issue a bit. Nothing was ever said of unset? Should unset be benign? Since unset() is intended to take an action (rather than check on state) shouldn't an invalid unset (one with a guarded property that doesn't have a setter) emit a warning? On 10/30/2012 10:37 PM, Clint Priest wrote: > Would you say the same of unset? Always benign? > > > On 10/29/2012 2:14 PM, Stas Malyshev wrote: >> Hi! >> >>> So... to be explicit here, you think in this situation: >>> >>> class a { >>> public $b { >>> set($x) { $this->b = $x; } >>> } >>> } >>> >>> $o = new a(); >>> >>> if(!isset($o->b)) { >>> /* delete files */ >>> } >>> echo (int)isset($o->b); /* This should return false and not emit any >>> sort of warning/notice? */ >> isset should return false, since $b is not set value. It should not >> produce any warning. Of course (int) would produce 0 then ;) >> >>> I mean specifically, there is no getter defined, therefore the result >>> if isset is indeterminate and while I can see it not causing execution >> No, the result is determinate - it's false. That's the point of isset() >> in PHP and that's how it is used in existing code. >> >>> to stop I don't see it being a good idea to not warn the developer that >>> what they've attempted is not correct. Without a getter, isset() is >>> not a legal call (since the value cannot be retrieved). >> isset() should always be legal. This is the way to check if $o->b is >> legal. >> >> > -- -Clint --------------000007050707030508050901--