From: Dmitry Stogov Date: Tue, 31 Oct 2017 23:39:09 +0000 (+0300) Subject: Use interned strings for stream transports X-Git-Tag: php-7.3.0alpha1~1118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8897c80956377b607837bd2ca18e38812671c691;p=php Use interned strings for stream transports --- diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 178f96f67e..1d31489429 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -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) diff --git a/main/streams/transports.c b/main/streams/transports.c index eb1909f1ce..9bd78426f9 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -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)