]> granicus.if.org Git - php/commitdiff
Use interned strings for stream transports
authorDmitry Stogov <dmitry@zend.com>
Tue, 31 Oct 2017 23:39:09 +0000 (02:39 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 31 Oct 2017 23:39:09 +0000 (02:39 +0300)
ext/opcache/ZendAccelerator.c
main/streams/transports.c

index 178f96f67ed7f850c6b09a03d4a1e98b86e153f9..1d314894294c803457dc73454963b189697a2166 100644 (file)
@@ -695,6 +695,13 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
                        p->key = new_interned_string(p->key);
                }
        } ZEND_HASH_FOREACH_END();
+
+       ht = php_stream_xport_get_hash();
+       ZEND_HASH_FOREACH_BUCKET(ht, p) {
+               if (p->key) {
+                       p->key = new_interned_string(p->key);
+               }
+       } ZEND_HASH_FOREACH_END();
 }
 
 static zend_string *accel_replace_string_by_shm_permanent(zend_string *str)
index eb1909f1ce3de0f7ebba608d6b54b45436115230..9bd78426f9e1019fa861ad80338727fc28569af0 100644 (file)
@@ -31,7 +31,7 @@ PHPAPI HashTable *php_stream_xport_get_hash(void)
 
 PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory)
 {
-       return zend_hash_str_update_ptr(&xport_hash, protocol, strlen(protocol), factory) ? SUCCESS : FAILURE;
+       return zend_hash_update_ptr(&xport_hash, zend_string_init_interned(protocol, strlen(protocol), 1), factory) ? SUCCESS : FAILURE;
 }
 
 PHPAPI int php_stream_xport_unregister(const char *protocol)