php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #66429
Patch interned_empty_string.patch revision 2014-01-06 23:27 UTC by Terry at ellisons dot org dot uk

Patch interned_empty_string.patch for opcache Bug #66429

Patch version 2014-01-06 23:27 UTC

Return to Bug #66429 | Download this patch
Patch Revisions:

Developer: Terry@ellisons.org.uk

--- a/ext/opcache/ZendAccelerator.h
+++ b/ext/opcache/ZendAccelerator.h
@@ -302,6 +302,9 @@ typedef struct _zend_accel_shared_globals {
        char           *interned_strings_start;
        char           *interned_strings_top;
        char           *interned_strings_end;
+#ifndef ZTS
+       char           *interned_empty_string;
+#endif
        HashTable       interned_strings;
        struct {
                Bucket **arBuckets;

--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -249,6 +249,9 @@ static ZEND_INI_MH(accel_include_path_on_modify)
 /* Interned strings support */
 static char *orig_interned_strings_start;
 static char *orig_interned_strings_end;
+#ifndef ZTS
+static char *orig_interned_empty_string;
+#endif
 static const char *(*orig_new_interned_string)(const char *str, int len, int free_src TSRMLS_DC);
 static void (*orig_interned_strings_snapshot)(TSRMLS_D);
 static void (*orig_interned_strings_restore)(TSRMLS_D);
@@ -2476,6 +2479,7 @@ static int zend_accel_init_shm(TSRMLS_D)
 
        CG(interned_strings_start) = ZCSG(interned_strings_start);
        CG(interned_strings_end) = ZCSG(interned_strings_end);
+       
        zend_new_interned_string = accel_new_interned_string_for_php;
        zend_interned_strings_snapshot = accel_interned_strings_snapshot_for_php;
        zend_interned_strings_restore = accel_interned_strings_restore_for_php;
@@ -2483,6 +2487,8 @@ static int zend_accel_init_shm(TSRMLS_D)
 # ifndef ZTS
        accel_use_shm_interned_strings(TSRMLS_C);
        accel_interned_strings_save_state(TSRMLS_C);
+       orig_interned_empty_string = CG(interned_empty_string);
+    CG(interned_empty_string) = accel_new_interned_string("", sizeof(""), 0 TSRMLS_CC);
 # endif
 
 #endif
@@ -2720,6 +2726,7 @@ void accel_shutdown(TSRMLS_D)
        zend_hash_clean(CG(function_table));
        zend_hash_clean(CG(class_table));
        zend_hash_clean(EG(zend_constants));
+       CG(interned_empty_string) = orig_interned_empty_string;
 # endif
        CG(interned_strings_start) = orig_interned_strings_start;
        CG(interned_strings_end) = orig_interned_strings_end;

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 17:01:27 2024 UTC