--FILE--
<?php
-set_error_handler(function() { echo 'Intercepted error!', "\n"; });
+var_dump(set_error_handler(
+ function() { echo 'Intercepted error!', "\n"; }
+));
trigger_error('Error!');
-set_error_handler(null);
+var_dump(set_error_handler(null));
trigger_error('Error!');
?>
--EXPECTF--
+NULL
Intercepted error!
+object(Closure)#1 (0) {
+}
Notice: Error! in %s on line %d
--- /dev/null
+--TEST--
+Bug #60738 Allow 'set_error_handler' to handle NULL
+--FILE--
+<?php
+
+var_dump(set_exception_handler(
+ function() { echo 'Intercepted exception!', "\n"; }
+));
+
+var_dump(set_exception_handler(null));
+
+throw new Exception('Exception!');
+?>
+--EXPECTF--
+NULL
+object(Closure)#1 (0) {
+}
+
+Fatal error: Uncaught exception 'Exception' with message 'Exception!' in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
+
if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
FREE_ZVAL(EG(user_error_handler));
EG(user_error_handler) = NULL;
- RETURN_TRUE;
+ return;
}
EG(user_error_handler_error_reporting) = (int)error_type;
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
FREE_ZVAL(EG(user_exception_handler));
EG(user_exception_handler) = NULL;
- RETURN_TRUE;
+ return;
}
MAKE_COPY_ZVAL(&exception_handler, EG(user_exception_handler))