From 569bfbd00b51588c992c384b99e0d2e97f0e91b9 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 1 Apr 2014 12:20:16 +0400 Subject: [PATCH] Keep constnat flags --- ext/opcache/zend_persist.c | 3 +++ ext/opcache/zend_persist_calc.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 5562f8c55d..d638acdb15 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -111,6 +111,7 @@ static zend_ast *zend_persist_ast(zend_ast *ast TSRMLS_DC) static void zend_persist_zval(zval *z TSRMLS_DC) { + zend_uchar flags; void *new_ptr; #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO @@ -120,7 +121,9 @@ static void zend_persist_zval(zval *z TSRMLS_DC) #endif case IS_STRING: case IS_CONSTANT: + flags = Z_STR_P(z)->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); zend_accel_store_interned_string(Z_STR_P(z)); + Z_STR_P(z)->gc.u.v.flags |= flags; break; case IS_ARRAY: case IS_CONSTANT_ARRAY: diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index 5bd358df5c..48038dcf48 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -73,7 +73,9 @@ static uint zend_hash_persist_calc(HashTable *ht, uint (*pPersistElement)(zval * /* persist bucket and key */ if (p->key) { + zend_uchar flags = p->key->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); ADD_INTERNED_STRING(p->key, 1); + p->key->gc.u.v.flags |= flags; } ADD_SIZE(pPersistElement(&p->val TSRMLS_CC)); @@ -105,6 +107,7 @@ static uint zend_persist_ast_calc(zend_ast *ast TSRMLS_DC) static uint zend_persist_zval_calc(zval *z TSRMLS_DC) { + zend_uchar flags; uint size; START_SIZE(); @@ -115,7 +118,9 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC) #endif case IS_STRING: case IS_CONSTANT: + flags = Z_STR_P(z)->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); ADD_INTERNED_STRING(Z_STR_P(z), 0); + Z_STR_P(z)->gc.u.v.flags |= flags; break; case IS_ARRAY: case IS_CONSTANT_ARRAY: -- 2.50.1