Permalink
Browse files

Fixed possible crash because of overriden error handler

  • Loading branch information...
1 parent fcc0fdd commit df9b7a1fe063214f48dffbd583248da8df95228e Dmitry Stogov committed Sep 17, 2008
Showing with 18 additions and 1 deletion.
  1. +16 −0 Zend/tests/closure_031.phpt
  2. +2 −1 Zend/zend_closures.c
@@ -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
+
View
@@ -136,7 +136,8 @@ static zend_function *zend_closure_get_method(zval **object_ptr, char *method_na
static zval *zend_closure_read_property(zval *object, zval *member, int type TSRMLS_DC) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
- return NULL;
+ Z_ADDREF(EG(uninitialized_zval));
+ return &EG(uninitialized_zval);
}
/* }}} */

0 comments on commit df9b7a1

Please sign in to comment.