From: Nikita Popov Date: Tue, 2 Jul 2019 10:28:46 +0000 (+0200) Subject: Merge branch 'PHP-7.3' into PHP-7.4 X-Git-Tag: php-7.4.0alpha3~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a08885ed9c0eec8a6131a591ce9ad714ac773f7;p=php Merge branch 'PHP-7.3' into PHP-7.4 --- 4a08885ed9c0eec8a6131a591ce9ad714ac773f7 diff --cc ext/opcache/ZendAccelerator.c index 5b49159421,90397bf8d7..ee9f45609b --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@@ -1879,7 -1904,31 +1879,30 @@@ zend_op_array *file_cache_compile_file( return op_array; } -#endif + int check_persistent_script_access(zend_persistent_script *persistent_script) + { + char *phar_path, *ptr; + int ret; + if ((ZSTR_LEN(persistent_script->script.filename)script.filename), "phar://", sizeof("phar://")-1)) { + + return access(ZSTR_VAL(persistent_script->script.filename), R_OK) != 0; + + } else { + /* we got a cached file from .phar, so we have to strip prefix and path inside .phar to check access() */ + phar_path = estrdup(ZSTR_VAL(persistent_script->script.filename)+sizeof("phar://")-1); + if ((ptr = strstr(phar_path, ".phar/")) != NULL) + { + *(ptr+sizeof(".phar/")-2) = 0; /* strip path inside .phar file */ + } + ret = access(phar_path, R_OK) != 0; + efree(phar_path); + return ret; + } + } + + /* zend_compile() replacement */ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type) {