com php-src: fix path handling for the file cache: ext/opcache/ zend_file_cache.c

From: Date: Fri, 17 Jul 2015 11:51:16 +0000
Subject: com php-src: fix path handling for the file cache: ext/opcache/ zend_file_cache.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88011@lists.php.net to get a copy of this message
Commit: 4c87750c26027431b0688168d90ff75e055524c1 Author: Anatol Belski <ab@php.net> Fri, 17 Jul 2015 13:50:40 +0200 Parents: 2c048afd3b1c539a1ad2b7997b5104cca2013327 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4c87750c26027431b0688168d90ff75e055524c1 Log: fix path handling for the file cache Changed paths: M ext/opcache/zend_file_cache.c Diff: diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 9314c89..4c02ca4 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -678,10 +678,26 @@ int zend_file_cache_script_store(zend_persistent_script *script, int in_shm) len = strlen(ZCG(accel_directives).file_cache); filename = emalloc(len + 33 + ZSTR_LEN(script->full_path) + sizeof(SUFFIX)); memcpy(filename, ZCG(accel_directives).file_cache, len); +#ifndef ZEND_WIN32 filename[len] = '/'; memcpy(filename + len + 1, ZCG(system_id), 32); memcpy(filename + len + 33, ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path)); memcpy(filename + len + 33 + ZSTR_LEN(script->full_path), SUFFIX, sizeof(SUFFIX)); +#else + filename[len] = '\\'; + memcpy(filename + len + 1, ZCG(system_id), 32); + if (ZSTR_LEN(script->full_path) >= 2 && ':' == ZSTR_VAL(script->full_path)[1]) { + /* local fs */ + *(filename + len + 33) = '\\'; + *(filename + len + 34) = ZSTR_VAL(script->full_path)[0]; + memcpy(filename + len + 35, ZSTR_VAL(script->full_path) + 2, ZSTR_LEN(script->full_path) - 2); + memcpy(filename + len + 35 + ZSTR_LEN(script->full_path) - 2, SUFFIX, sizeof(SUFFIX)); + } else { + /* network path */ + memcpy(filename + len + 33, ZSTR_VAL(script->full_path), ZSTR_LEN(script->full_path)); + memcpy(filename + len + 33 + ZSTR_LEN(script->full_path), SUFFIX, sizeof(SUFFIX)); + } +#endif if (zend_file_cache_mkdir(filename, len) != SUCCESS) { zend_accel_error(ACCEL_LOG_WARNING, "opcache cannot create directory for file '%s'\n", filename);

« previous php.cvs (#88011) next »