com php-src: Assert that references are not persisted: ext/opcache/zend_persist.c ext/opcache/zend_persist_c alc.c

From: Date: Wed, 04 Nov 2020 13:51:44 +0000
Subject: com php-src: Assert that references are not persisted: ext/opcache/zend_persist.c ext/opcache/zend_persist_c alc.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-114061@lists.php.net to get a copy of this message
Commit: 7794925ba4d7510f4afc5d5a83358aa4106bf189 Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 4 Nov 2020 14:51:44 +0100 Parents: 57b0e5a0455e621bec7acfbf57fb3da8776d1465 Branches: PHP-8.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7794925ba4d7510f4afc5d5a83358aa4106bf189 Log: Assert that references are not persisted There should not be any need to persist references, and it's unlikely that persisting a reference will behave correctly at runtime, because we don't have a concept of an immutable reference. Changed paths: M ext/opcache/zend_persist.c M ext/opcache/zend_persist_calc.c Diff: diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 77d67851b45..efadcb91fb9 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -230,15 +230,6 @@ static void zend_persist_zval(zval *z) } } break; - case IS_REFERENCE: - new_ptr = zend_shared_alloc_get_xlat_entry(Z_REF_P(z)); - if (new_ptr) { - Z_REF_P(z) = new_ptr; - } else { - Z_REF_P(z) = zend_shared_memdup_put_free(Z_REF_P(z), sizeof(zend_reference)); - zend_persist_zval(Z_REFVAL_P(z)); - } - break; case IS_CONSTANT_AST: new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z)); if (new_ptr) { @@ -254,8 +245,7 @@ static void zend_persist_zval(zval *z) } break; default: - ZEND_ASSERT(Z_TYPE_P(z) != IS_OBJECT); - ZEND_ASSERT(Z_TYPE_P(z) != IS_RESOURCE); + ZEND_ASSERT(Z_TYPE_P(z) < IS_STRING); break; } } diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 4a612751a6c..9de02e91e28 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -128,13 +128,6 @@ static void zend_persist_zval_calc(zval *z) } ZEND_HASH_FOREACH_END(); } break; - case IS_REFERENCE: - size = zend_shared_memdup_size(Z_REF_P(z), sizeof(zend_reference)); - if (size) { - ADD_SIZE(size); - zend_persist_zval_calc(Z_REFVAL_P(z)); - } - break; case IS_CONSTANT_AST: size = zend_shared_memdup_size(Z_AST_P(z), sizeof(zend_ast_ref)); if (size) { @@ -143,8 +136,7 @@ static void zend_persist_zval_calc(zval *z) } break; default: - ZEND_ASSERT(Z_TYPE_P(z) != IS_OBJECT); - ZEND_ASSERT(Z_TYPE_P(z) != IS_RESOURCE); + ZEND_ASSERT(Z_TYPE_P(z) < IS_STRING); break; } }

« previous php.cvs (#114061) next »