On 29/10/12 03:02, Clint Priest wrote:
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).
I agree with Pierre, isset() should never throw a warning/notice. The
primary use of isset (that I've seen in various code-bases) is to avoid
warnings/notices. Only rarely do I see it used in an expression to
control application logic. The above example should not give a warning,
and should return false. As far as an application is concerned, $o->b
doesn't exist because it can't be read.
David
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php