From 6008ac8e321e4141d78abff82b7fba74e41bac1b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 28 May 2013 23:45:36 +0400 Subject: [PATCH] Fixed crash during search in empty persistent HashTable --- ext/opcache/zend_persist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index 0bffae4d0e..9f1940e061 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -52,6 +52,10 @@ typedef void (*zend_persist_func_t)(void * TSRMLS_DC); static void zend_persist_zval_ptr(zval **zp TSRMLS_DC); +#if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO +static const Bucket *uninitialized_bucket = NULL; +#endif + static void zend_hash_persist(HashTable *ht, void (*pPersistElement)(void *pElement TSRMLS_DC), size_t el_size TSRMLS_DC) { Bucket *p = ht->pListHead; @@ -129,7 +133,7 @@ static void zend_hash_persist(HashTable *ht, void (*pPersistElement)(void *pElem zend_accel_store(ht->arBuckets, sizeof(Bucket*) * ht->nTableSize); #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO } else { - ht->arBuckets = NULL; + ht->arBuckets = (Bucket**)&uninitialized_bucket; } #endif } -- 2.50.1