com php-src: Fixed #73973 - debug_zval_dump() asserti on error for resource consts with --enable-debug: NEWS Zend/zend_builtin_functions.c
Zend/zend_exe cute_API.c ext/standard/tests/general_functions/bug7 3973.phpt

From: Date: Thu, 26 Jan 2017 09:03:47 +0000
Subject: com php-src: Fixed #73973 - debug_zval_dump() asserti on error for resource consts with --enable-debug: NEWS Zend/zend_builtin_functions.c
Zend/zend_exe cute_API.c ext/standard/tests/general_functions/bug7 3973.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96880@lists.php.net to get a copy of this message
Commit: f65ae82c55b986fbc1e140de998b4a9c44911cac Author: andrewnester <andrew.nester.dev@gmail.com> Tue, 24 Jan 2017 16:38:30 +0300 Committer: Joe Watkins <krakjoe@php.net> Thu, 26 Jan 2017 09:03:47 +0000 Parents: a15c1990ebf0dc7929511482ef9b59bad903b0bc Branches: PHP-7..0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f65ae82c55b986fbc1e140de998b4a9c44911cac Log: Fixed #73973 - debug_zval_dump() assertion error for resource consts with --enable-debug Bugs: https://bugs.php.net/73973 Changed paths: M NEWS M Zend/zend_builtin_functions.c M Zend/zend_execute_API.c A ext/standard/tests/general_functions/bug73973.phpt Diff: diff --git a/NEWS b/NEWS index 686efb6..b0566a9 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ PHP NEWS . Fixed bug #73876 (Crash when exporting **= in expansion of assign op). (Sara) . Fixed bug #73969 (segfault in debug_print_backtrace). (andrewnester) + . Fixed bug #73973 (assertion error in debug_zval_dump). (andrewnester) - DOM: . Fixed bug #54382 (getAttributeNodeNS doesn't get xmlns* attributes). diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 547d3f0..aa705d3 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -808,9 +808,6 @@ static void copy_constant_array(zval *dst, zval *src) /* {{{ */ } } else if (Z_REFCOUNTED_P(val)) { Z_ADDREF_P(val); - if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_RESOURCE_EX)) { - Z_TYPE_INFO_P(new_val) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); - } } } ZEND_HASH_FOREACH_END(); } @@ -853,12 +850,7 @@ repeat: case IS_FALSE: case IS_TRUE: case IS_NULL: - break; case IS_RESOURCE: - ZVAL_COPY(&val_free, val); - /* TODO: better solution than this tricky disable dtor on resource? */ - Z_TYPE_INFO(val_free) &= ~(IS_TYPE_REFCOUNTED << Z_TYPE_FLAGS_SHIFT); - val = &val_free; break; case IS_ARRAY: if (!Z_IMMUTABLE_P(val)) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 51baac2..28a75b7 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -344,6 +344,10 @@ void shutdown_executor(void) /* {{{ */ } zend_end_try(); zend_try { + clean_non_persistent_constants(); + } zend_end_try(); + + zend_try { zend_close_rsrc_list(&EG(regular_list)); } zend_end_try(); @@ -375,10 +379,6 @@ void shutdown_executor(void) /* {{{ */ } zend_end_try(); zend_try { - clean_non_persistent_constants(); - } zend_end_try(); - - zend_try { #if 0&&ZEND_DEBUG signal(SIGSEGV, original_sigsegv_handler); #endif diff --git a/ext/standard/tests/general_functions/bug73973.phpt b/ext/standard/tests/general_functions/bug73973.phpt new file mode 100644 index 0000000..8bb4daa --- /dev/null +++ b/ext/standard/tests/general_functions/bug73973.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #73973 debug_zval_dump() assertion error for resource consts with --enable-debug +--FILE-- +<?php +define('myerr', fopen('php://stderr', 'w')); +debug_zval_dump(myerr); +?> +--EXPECTF-- +resource(5) of type (stream) refcount(%d)

« previous php.cvs (#96880) next »