Skip to content

Commit 306f55b

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Fixed #73973 - debug_zval_dump() assertion error for resource consts with --enable-debug
2 parents 4e3a4c1 + 2d339fa commit 306f55b

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PHP NEWS
2525
. Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester)
2626
. Added PHP_OS_FAMILY constant to determine on which OS we are. (Jan Altensen)
2727
. Fixed bug #73994 (arginfo incorrect for unpack). (krakjoe)
28+
. Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester)
2829

2930
- BCMath:
3031
. Fixed bug #46564 (bcmod truncates fractionals). (liborm85)

Zend/zend_builtin_functions.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,6 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */
879879
}
880880
} else if (Z_REFCOUNTED_P(val)) {
881881
Z_ADDREF_P(val);
882-
if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_RESOURCE_EX)) {
883-
Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
884-
}
885882
}
886883
} ZEND_HASH_FOREACH_END();
887884
}
@@ -924,12 +921,7 @@ ZEND_FUNCTION(define)
924921
case IS_FALSE:
925922
case IS_TRUE:
926923
case IS_NULL:
927-
break;
928924
case IS_RESOURCE:
929-
ZVAL_COPY(&val_free, val);
930-
/* TODO: better solution than this tricky disable dtor on resource? */
931-
Z_TYPE_INFO(val_free) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT);
932-
val = &val_free;
933925
break;
934926
case IS_ARRAY:
935927
if (Z_REFCOUNTED_P(val)) {

Zend/zend_execute_API.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ void shutdown_executor(void) /* {{{ */
345345
zend_llist_destroy(&CG(open_files));
346346
} zend_end_try();
347347

348+
zend_try {
349+
clean_non_persistent_constants();
350+
} zend_end_try();
351+
348352
zend_try {
349353
zend_close_rsrc_list(&EG(regular_list));
350354
} zend_end_try();
@@ -376,10 +380,6 @@ void shutdown_executor(void) /* {{{ */
376380
}
377381
} zend_end_try();
378382

379-
zend_try {
380-
clean_non_persistent_constants();
381-
} zend_end_try();
382-
383383
zend_try {
384384
#if 0&&ZEND_DEBUG
385385
signal(SIGSEGV, original_sigsegv_handler);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--TEST--
2+
Bug #73973 debug_zval_dump() assertion error for resource consts with --enable-debug
3+
--FILE--
4+
<?php
5+
define('myerr', fopen('php://stderr', 'w'));
6+
debug_zval_dump(myerr);
7+
?>
8+
--EXPECTF--
9+
resource(5) of type (stream) refcount(%d)

0 commit comments

Comments
 (0)