Hello,

The following code does not work as expected:

<?
class Test {
  function __get($n) {
    print('[get]');
    throw new Exception('get');
    print('[/get]'); // not printed: OK
  }
}

print('[test]');
$o = new Test();
$v = $o->foo;
print('[/test]'); // printed: bug
?>

'/get' is not printed, so the throw statement is correctly executed, but '/test' is 
printed, so the exception is not correctly "propagated" to the caller.

Note that the exception will be thrown later, either:
 * if the call to __get was not in a function: end of script,
 * if the call to __get was within a function: end of the function,
except if antoher exception is thrown, but in that case the get exception is reported, 
not the newly thrown one.

Same behaviour with __set and __toString.

Apparently no problems with __construct, __destruct, __call and __clone.

Regards,
Stephane

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

Reply via email to