#41742 [NEW]: When using a language construct, magic functions are not called in a object

From: Date: Tue, 19 Jun 2007 20:51:56 +0000
Subject: #41742 [NEW]: When using a language construct, magic functions are not called in a object
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113940@lists.php.net to get a copy of this message
From: gatorv at gmail dot com Operating system: Windows Vista PHP version: 5.2.3 PHP Bug Type: Scripting Engine problem Bug description: When using a language construct, magic functions are not called in a object Description: ------------ If you use a language construct ej: empty on a object and want to call a magic function ej: __get, the function is not called and the function fails. Reproduce code: --------------- class Test { public $input; public function __construct() { $this->input = array( "foo" => "bar" ); } public function __get( $var ) { return $this->input[$var]; } } $test = new Test(); if( empty( $test->foo ) ) { echo "Foo on Test is empty"; } else { echo "Foo on Test is not empty"; } Expected result: ---------------- Foo on Test is not empty. Actual result: -------------- Foo on Test is empty -- Edit bug report at http://bugs.php.net/?id=41742&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41742&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41742&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41742&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41742&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41742&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41742&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41742&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41742&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41742&r=support Expected behavior: http://bugs.php.net/fix.php?id=41742&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41742&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41742&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41742&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41742&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41742&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41742&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41742&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41742&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41742&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41742&r=mysqlcfg

« previous php.bugs (#113940) next »