|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-09-01 08:58 UTC] opitz dot alexander at googlemail dot com
Description: ------------ While trying to run the TYPO3 functional tests I get several core dumps. Expected result: ---------------- No core dump by SIGSEGV Actual result: -------------- core dump with SIGSEGV Backtrace: #0 0x0000000000a26bab in zend_ast_destroy_ex (ast=0xffffffff00000002, free=1 '\001') at /php7/Zend/zend_ast.c:452 #1 0x0000000000a26d8e in zend_ast_destroy_and_free (ast=0xffffffff00000002) at /php7/Zend/zend_ast.c:501 #2 0x00000000009e141b in _zval_dtor_func (p=0x7f0cafccb070, __zend_filename=0x1050580 "/php7/Zend/zend_constants.c", __zend_lineno=36) at /php7/Zend/zend_variables.c:50 #3 0x00000000009c802e in _zval_dtor (zvalue=0x7f0cafca7940, __zend_filename=0x1050580 "/php7/Zend/zend_constants.c", __zend_lineno=36) at /php7/Zend/zend_variables.h:44 #4 0x00000000009c813f in free_zend_constant (zv=0x7ffe99c7e4e0) at /php7/Zend/zend_constants.c:36 #5 0x00000000009fa293 in _zend_hash_del_el_ex (ht=0x1f8af90, idx=1880, p=0x20a4690, prev=0x0) at /php7/Zend/zend_hash.c:958 #6 0x00000000009fa372 in _zend_hash_del_el (ht=0x1f8af90, idx=1880, p=0x20a4690) at /php7/Zend/zend_hash.c:982 #7 0x00000000009fbbb3 in zend_hash_reverse_apply (ht=0x1f8af90, apply_func=0x9c82db <clean_non_persistent_constant>) at /php7/Zend/zend_hash.c:1555 #8 0x00000000009c8773 in clean_non_persistent_constants () at /php7/Zend/zend_constants.c:161 #9 0x00000000009cb659 in shutdown_executor () at /php7/Zend/zend_execute_API.c:378 #10 0x00000000009e3df7 in zend_deactivate () at /php7/Zend/zend.c:969 #11 0x000000000094c602 in php_request_shutdown (dummy=0x0) at /php7/main/main.c:1810 #12 0x0000000000aab98c in do_cli (argc=1, argv=0x1f6e360) at /php7/sapi/cli/php_cli.c:1139 #13 0x0000000000aac207 in main (argc=1, argv=0x1f6e360) at /php7/sapi/cli/php_cli.c:1338 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 16:00:01 2025 UTC |
./sapi/cli/php -r 'define("TEST", fopen("php://temp", "w+b"));' gives me a few invalid reads with valgrind. The fix is actually simple: In shutdown_executor(), move the call to clean_non_persistent_constants(); a few lines up above zend_close_rsrc_list(&EG(regular_list)); Though, I'm not sure if that might have side-effects [AFAIK, misordering in shutdown often causes subtle breaks] … so, can you please verify, Xinchen?could you please verify whether the following patch fixed the problem? diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index fc834df..5dceaae 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -864,6 +864,10 @@ repeat: } ZVAL_DUP(&c.value, val); + if (Z_TYPE_INFO(c.value) == IS_RESOURCE_EX) { + /* disable resource constant destruction */ + Z_TYPE_INFO(c.value) = IS_RESOURCE; + } zval_ptr_dtor(&val_free); register_constant: c.flags = case_sensitive; /* non persistent */Hence, I propose this alternative patch (assuming constants are only ever freed at the end of the run): diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 8d1be74..10648e4 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -33,7 +33,9 @@ void free_zend_constant(zval *zv) zend_constant *c = Z_PTR_P(zv); if (!(c->flags & CONST_PERSISTENT)) { - zval_dtor(&c->value); + if (Z_TYPE(c->value) != IS_RESOURCE) { + zval_dtor(&c->value); + } } else { zval_internal_dtor(&c->value); }