com php-src: Fix assertion violation with composer: Zend/tests/unused_shared_static_variables.phpt Zend/z end_opcode.c

From: Date: Tue, 24 Jan 2017 10:32:41 +0000
Subject: com php-src: Fix assertion violation with composer: Zend/tests/unused_shared_static_variables.phpt Zend/z end_opcode.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-96859@lists.php.net to get a copy of this message
Commit: a1d5686a3c461f8e1b5833a14b699326b8e23987 Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 24 Jan 2017 11:32:04 +0100 Parents: 08004d7959563a58bcf166b65589e769eba2f005 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a1d5686a3c461f8e1b5833a14b699326b8e23987 Log: Fix assertion violation with composer Changed paths: A Zend/tests/unused_shared_static_variables.phpt M Zend/zend_opcode.c Diff: diff --git a/Zend/tests/unused_shared_static_variables.phpt b/Zend/tests/unused_shared_static_variables.phpt new file mode 100644 index 0000000..fc87a19 --- /dev/null +++ b/Zend/tests/unused_shared_static_variables.phpt @@ -0,0 +1,16 @@ +--TEST-- +Cleanup of shared static variables HT that has never been used should not assert +--FILE-- +<?php + +class A { + public function test() { + static $x; + } +} +class B extends A {} + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 438feb4..7c79703 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -151,7 +151,14 @@ ZEND_API void zend_function_dtor(zval *zv) ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array) { if (op_array->static_variables && - !(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) { + !(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE) + ) { + /* The static variables are initially shared when inheriting methods and will + * be separated on first use. If they are never used, they stay shared. Cleaning + * a shared static variables table is safe, as the intention is to clean all + * such tables. */ + HT_ALLOW_COW_VIOLATION(op_array->static_variables); + zend_hash_clean(op_array->static_variables); } }

« previous php.cvs (#96859) next »