Re: [RFC] Property Accessors v1.2 : isset / unset "failable"

From: Date: Sun, 28 Oct 2012 16:02:46 +0000
Subject: Re: [RFC] Property Accessors v1.2 : isset / unset "failable"
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-63692@lists.php.net to get a copy of this message
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? */ I mean specifically, there is no getter defined, therefore the result if isset is indeterminate and while I can see it not causing execution 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). On Sunday, October 28, 2012 4:02:23 AM, Pierre Joye wrote:
hi Clint, On Sat, Oct 27, 2012 at 7:39 PM, Clint Priest <cpriest@zerocue.com> wrote:
That's basically what #2 is getting at, my only question is, emit a warning or notice or not? Technically returning false on an invalid isset() call could be misleading without emitting some kind of notice or warning about it.
isset is used for this exact purpose, avoid noisy scripts while testing the existence (instance, init'ed, etc.) of a variable or property. Raising a notice here sounds wrong, no matter in which context. Cheers,
-- -Clint

« previous php.internals (#63692) next »