ID: 26866
Updated by: [EMAIL PROTECTED]
Reported By: davojan at mail dot ru
-Status: Open
+Status: Verified
Bug Type: Zend Engine 2 problem
Operating System: FreeBSD 4.7-RELEASE
-PHP Version: 5.0.0b3 (beta3)
+PHP Version: 5CVS-2004-01-13
Previous Comments:
------------------------------------------------------------------------
[2004-01-10 18:44:57] davojan at mail dot ru
Description:
------------
As I imagine, PHP must not check bar's type in $foo->bar->get_name()
call, if bar is a result of __get() function and an exception was
raised in it. However it does so.
The example below works fine, if we comment the "throw" line - the
result in browser is 'bar'.
Reproduce code:
---------------
<?
class bar {
function get_name() {
return 'bar';
}
}
class foo {
function __get($sName) {
throw new Exception('Exception!');
return new bar();
}
}
$foo = new foo();
try {
echo $foo->bar->get_name();
}
catch (Exception $E) {
echo 'Exception raised!';
}
?>
Expected result:
----------------
Exception raised!
Actual result:
--------------
Fatal error: Call to a member function get_name() on a non-object in
/usr/local/www/data-dist/ils/admin/test/get_ex.php on line 15
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26866&edit=1