diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 4df75049e172..e56904d7efb8 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1517,10 +1517,10 @@ static void zend_accel_add_key(zend_string *key, zend_accel_hash_entry *bucket) } } +/* Must perform the same check as phar_compile_file(). */ static zend_always_inline bool is_phar_file(zend_string *filename) { - return filename && ZSTR_LEN(filename) >= sizeof(".phar") && - !memcmp(ZSTR_VAL(filename) + ZSTR_LEN(filename) - (sizeof(".phar")-1), ".phar", sizeof(".phar")-1) && + return filename && strstr(ZSTR_VAL(filename), ".phar") && !strstr(ZSTR_VAL(filename), "://"); } diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt index 29e6f02808a7..20fe7636ff08 100644 --- a/ext/opcache/tests/issue0149.phpt +++ b/ext/opcache/tests/issue0149.phpt @@ -22,7 +22,7 @@ unset($p); include "php_cli_server.inc"; -$ini = '-d opcache.enable=1 -d opcache.enable_cli=1'; +$ini = '-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.file_update_protection=0'; if (file_exists(ini_get('extension_dir').'/phar.'.PHP_SHLIB_SUFFIX)) { $ini .= ' -d extension=phar.'.PHP_SHLIB_SUFFIX; }