#41742 [Opn->Bgs]: When using a language construct, magic functions are not called in a object
| From: | derick@php.net | Date: | Tue, 19 Jun 2007 21:06:53 +0000 |
| Subject: | #41742 [Opn->Bgs]: When using a language construct, magic functions are not called in a object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113941@lists.php.net to get a copy of this message | ||
ID: 41742
Updated by: derick@php.net
Reported By: gatorv at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows Vista
PHP Version: 5.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
You need to implement __isset() to catch this.
Previous Comments:
------------------------------------------------------------------------
[2007-06-19 20:51:56] gatorv at gmail dot com
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 this bug report at http://bugs.php.net/?id=41742&edit=1