|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.16
+- Core:
+ . Fixed bug #63206 (restore_error_handler does not restore previous errors
+ mask). (Mark Plomer)
+
- COM:
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
(cmb)
--- /dev/null
+--TEST--
+Bug #63206 Fully support error_handler stacking, even inside the error_handler
+--FILE--
+<?php
+
+set_error_handler(function() {
+ echo 'First handler' . PHP_EOL;
+});
+
+set_error_handler(function() {
+ echo 'Second handler' . PHP_EOL;
+
+ set_error_handler(function() {
+ echo 'Internal handler' . PHP_EOL;
+ });
+
+ $triggerInternalNotice++; // warnings while handling the error should go into internal handler
+
+ restore_error_handler();
+});
+
+$triggerNotice1++;
+$triggerNotice2++;
+?>
+--EXPECTF--
+Second handler
+Internal handler
+Second handler
+Internal handler
--- /dev/null
+--TEST--
+Bug #63206 Fully support error_handler stacking, even with null
+--FILE--
+<?php
+
+set_error_handler(function() {
+ echo 'First handler' . PHP_EOL;
+});
+
+set_error_handler(function() {
+ echo 'Second handler' . PHP_EOL;
+});
+
+set_error_handler(null);
+
+set_error_handler(function() {
+ echo 'Fourth handler' . PHP_EOL;
+});
+
+restore_error_handler();
+restore_error_handler();
+
+$triggerNotice++;
+?>
+--EXPECTF--
+Second handler
--- /dev/null
+--TEST--
+Bug #63206 Fully support exception_handler stacking, even with null
+--FILE--
+<?php
+
+set_exception_handler(function() {
+ echo 'First handler' . PHP_EOL;
+});
+
+set_exception_handler(function() {
+ echo 'Second handler' . PHP_EOL;
+});
+
+set_exception_handler(null);
+
+set_exception_handler(function() {
+ echo 'Fourth handler' . PHP_EOL;
+});
+
+restore_exception_handler();
+restore_exception_handler();
+
+throw new Exception();
+?>
+--EXPECTF--
+Second handler
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_error_handler));
-
- zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
- zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
}
+ zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
+ zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
+
if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_error_handler));
return;
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_exception_handler));
-
- zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
}
+ zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
+
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_exception_handler));
return;