From: dasch at ulmail dot net
Operating system: Linux
PHP version: 5.0.1
PHP Bug Type: Class/Object related
Bug description: isset() always return
Description:
------------
When trying to determine whether or not a property in an overloaded object
is set, isset() always returns FALSE. This is not the case with objects
that isn't overloaded (doesn't have a __get() method defined).
Reproduce code:
---------------
<?php
class OO
{
private $elem = array("a" => 1);
public function __get ($prop)
{
if (isset($this->elem[$prop])) {
return $this->elem[$prop];
} else {
return NULL;
}
}
public function __set ($prop, $val)
{
$this->elem[$prop] = $val;
}
}
$o = new OO();
echo isset($o->a) ? "yes\n" : "no\n";
echo isset($o->b) ? "yes\n" : "no\n";
echo is_null($o->a) ? "yes\n" : "no\n";
echo is_null($o->b) ? "yes\n" : "no\n";
?>
Expected result:
----------------
yes
no
no
yes
Actual result:
--------------
no
no
no
yes
--
Edit bug report at http://bugs.php.net/?id=29917&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29917&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29917&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29917&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=29917&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29917&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29917&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29917&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29917&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29917&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29917&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29917&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29917&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29917&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29917&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29917&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29917&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29917&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29917&r=float