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 <cpri...@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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to