mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fixed possible crash because of overriden error handler
This commit is contained in:
parent
7fe09faebd
commit
d083b068ce
2 changed files with 18 additions and 1 deletions
16
Zend/tests/closure_031.phpt
Normal file
16
Zend/tests/closure_031.phpt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--TEST--
|
||||||
|
Closure 031: Closure properties with custom error handlers
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
function foo($errno, $errstr, $errfile, $errline) {
|
||||||
|
echo "Error: $errstr\n";
|
||||||
|
}
|
||||||
|
set_error_handler('foo');
|
||||||
|
$foo = function() {
|
||||||
|
};
|
||||||
|
var_dump($foo->a);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
Error: Closure object cannot have properties
|
||||||
|
NULL
|
||||||
|
|
|
@ -140,7 +140,8 @@ static zend_function *zend_closure_get_method(zval **object_ptr, zstr method_nam
|
||||||
static zval *zend_closure_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */
|
static zval *zend_closure_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
ZEND_CLOSURE_PROPERTY_ERROR();
|
ZEND_CLOSURE_PROPERTY_ERROR();
|
||||||
return NULL;
|
Z_ADDREF(EG(uninitialized_zval));
|
||||||
|
return &EG(uninitialized_zval);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue