com php-src: Fixed issue #115 (path issue when using phar). Fixed issue #149 (Phar mount points not working with OPcache enabled).: NEWS
ext/opcache/ZendAccelerator.c
| From: | Dmitry Stogov | Date: | Fri, 08 Nov 2013 12:35:05 +0000 |
| Subject: | com php-src: Fixed issue #115 (path issue when using phar). Fixed issue #149 (Phar mount points not working with OPcache enabled).: NEWS ext/opcache/ZendAccelerator.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73900@lists.php.net to get a copy of this message | ||
Commit: 915c428ba1006a144c4fca45e44631ec058a5074
Author: Dmitry Stogov <dmitry@zend.com> Fri, 8 Nov 2013 16:35:05 +0400
Parents: 49fbe2579e9cbb4314346c8eaf959c670de0abdb
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=915c428ba1006a144c4fca45e44631ec058a5074
Log:
Fixed issue #115 (path issue when using phar).
Fixed issue #149 (Phar mount points not working with OPcache enabled).
Bugs:
https://bugs.php.net/115
https://bugs.php.net/149
Changed paths:
M NEWS
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/NEWS b/NEWS
index 0fd30ce..d0359fe 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ PHP NEWS
- OPcache
. Increased limit for opcache.max_accelerated_files to 1,000,000. (Chris)
+ . Fixed issue #115 (path issue when using phar). (Dmitry)
+ . Fixed issue #149 (Phar mount points not working with OPcache enabled).
+ (Dmitry)
- ODBC
. Fixed bug #65950 (Field name truncation if the field name is bigger than
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 72b5a1b..8eaa0a3 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -1196,6 +1196,8 @@ static zend_persistent_script
*cache_script_in_shared_memory(zend_persistent_scr
/* store script structure in the hash table */
bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path,
new_persistent_script->full_path_len + 1, 0, new_persistent_script);
if (bucket &&
+ /* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
+ memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
(new_persistent_script->full_path_len != key_length ||
memcmp(new_persistent_script->full_path, key, key_length) != 0)) {
/* link key to the same persistent script in hash table */
@@ -1651,7 +1653,18 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int
type T
#endif
void *dummy = (void *) 1;
- zend_hash_quick_add(&EG(included_files), persistent_script->full_path,
persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void
*), NULL);
+ if (zend_hash_quick_add(&EG(included_files), persistent_script->full_path,
persistent_script->full_path_len + 1, persistent_script->hash_value, &dummy, sizeof(void
*), NULL) == SUCCESS) {
+ /* ext/phar has to load phar's metadata into memory */
+ if (strstr(persistent_script->full_path, ".phar") &&
!strstr(persistent_script->full_path, "://")) {
+ php_stream_statbuf ssb;
+ char *fname = emalloc(sizeof("phar://") + persistent_script->full_path_len);
+
+ memcpy(fname, "phar://", sizeof("phar://") - 1);
+ memcpy(fname + sizeof("phar://") - 1, persistent_script->full_path,
persistent_script->full_path_len + 1);
+ php_stream_stat_path(fname, &ssb);
+ efree(fname);
+ }
+ }
}
}
#if ZEND_EXTENSION_API_NO < PHP_5_3_X_API_NO