Annotation of embedaddon/php/Zend/tests/bug41209.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #41209 (Segmentation fault with ArrayAccess, set_error_handler and undefined var)
! 3: --FILE--
! 4: <?php
! 5:
! 6: class env
! 7: {
! 8: public function __construct()
! 9: {
! 10: set_error_handler(array(__CLASS__, 'errorHandler'));
! 11: }
! 12:
! 13: public static function errorHandler($errno, $errstr, $errfile, $errline)
! 14: {
! 15: throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
! 16: }
! 17: }
! 18:
! 19: class cache implements ArrayAccess
! 20: {
! 21: private $container = array();
! 22:
! 23: public function offsetGet($id) {}
! 24:
! 25: public function offsetSet($id, $value) {}
! 26:
! 27: public function offsetUnset($id) {}
! 28:
! 29: public function offsetExists($id)
! 30: {
! 31: return isset($this->containers[(string) $id]);
! 32: }
! 33: }
! 34:
! 35: $env = new env();
! 36: $cache = new cache();
! 37: var_dump(isset($cache[$id]));
! 38:
! 39: echo "Done\n";
! 40: ?>
! 41: --EXPECTF--
! 42: Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: id' in %s:%d
! 43: Stack trace:
! 44: #0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array)
! 45: #1 {main}
! 46: thrown in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>