summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-11-01 02:39:09 +0300
committerDmitry Stogov <dmitry@zend.com>2017-11-01 02:39:09 +0300
commit8897c80956377b607837bd2ca18e38812671c691 (patch)
tree15d0d8c4671d814db2c45b656a83503e5d98a615
parented5b4d5c99a311e8c026b1aa7faf5f7b308f0b84 (diff)
downloadphp-git-8897c80956377b607837bd2ca18e38812671c691.tar.gz
Use interned strings for stream transports
-rw-r--r--ext/opcache/ZendAccelerator.c7
-rw-r--r--main/streams/transports.c2
2 files changed, 8 insertions, 1 deletions
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)