Skip to content

Commit f982038

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4:   Improve error_handing replacement functions # Conflicts: # Zend/zend_API.c
2 parents 486866c + 45ed9b4 commit f982038

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

Zend/zend.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ typedef enum {
344344
typedef struct {
345345
zend_error_handling_t handling;
346346
zend_class_entry *exception;
347-
zval user_handler;
348347
} zend_error_handling;
349348

350349
ZEND_API void zend_save_error_handling(zend_error_handling *current);

Zend/zend_API.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4277,33 +4277,24 @@ ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
42774277
{
42784278
current->handling = EG(error_handling);
42794279
current->exception = EG(exception_class);
4280-
ZVAL_COPY(&current->user_handler, &EG(user_error_handler));
42814280
}
42824281
/* }}} */
42834282

42844283
ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling, zend_class_entry *exception_class, zend_error_handling *current) /* {{{ */
42854284
{
42864285
if (current) {
42874286
zend_save_error_handling(current);
4288-
if (error_handling != EH_NORMAL && Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
4289-
zval_ptr_dtor(&EG(user_error_handler));
4290-
ZVAL_UNDEF(&EG(user_error_handler));
4291-
}
42924287
}
4288+
ZEND_ASSERT(error_handling == EH_THROW || exception_class == NULL);
42934289
EG(error_handling) = error_handling;
4294-
EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL;
4290+
EG(exception_class) = exception_class;
42954291
}
42964292
/* }}} */
42974293

42984294
ZEND_API void zend_restore_error_handling(zend_error_handling *saved) /* {{{ */
42994295
{
43004296
EG(error_handling) = saved->handling;
4301-
EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL;
4302-
if (Z_TYPE(saved->user_handler) != IS_UNDEF) {
4303-
zval_ptr_dtor(&EG(user_error_handler));
4304-
ZVAL_COPY_VALUE(&EG(user_error_handler), &saved->user_handler);
4305-
ZVAL_UNDEF(&saved->user_handler);
4306-
}
4297+
EG(exception_class) = saved->exception;
43074298
}
43084299
/* }}} */
43094300

0 commit comments

Comments
 (0)