com php-src: Fixed Issue #140: "opcache.enable_file_ove rride" doesn't respect "opcache.revalidate_freq ": NEWS ext/opcache/ZendAccelerator.c
ext/opcache/Z endAccelerator.h ext/opcache/tests/issue0140.phpt ext/opcache/zend_accelerator_module.c

From: Date: Mon, 23 Dec 2013 11:34:26 +0000
Subject: com php-src: Fixed Issue #140: "opcache.enable_file_ove rride" doesn't respect "opcache.revalidate_freq ": NEWS ext/opcache/ZendAccelerator.c
ext/opcache/Z endAccelerator.h ext/opcache/tests/issue0140.phpt ext/opcache/zend_accelerator_module.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-75419@lists.php.net to get a copy of this message
Commit: 9c5a902106e781ba6414b3b474157052c69210ad Author: Dmitry Stogov <dmitry@zend.com> Mon, 23 Dec 2013 12:46:30 +0400 Committer: Anatol Belski <ab@php.net> Mon, 23 Dec 2013 12:34:26 +0100 Parents: 78f2ded86a8a33b3320444d2a8c67b431da5a662 Branches: str_size_and_int64 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9c5a902106e781ba6414b3b474157052c69210ad Log: Fixed Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq" Bugs: https://bugs.php.net/140 Changed paths: M NEWS M ext/opcache/ZendAccelerator.c M ext/opcache/ZendAccelerator.h A ext/opcache/tests/issue0140.phpt M ext/opcache/zend_accelerator_module.c Diff: diff --git a/NEWS b/NEWS index a1fa83c..a1635d7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,65 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 20??, PHP 5..7.0 +- Core: + . Disallowed JMP into a finally block. (Laruence) + . Added validation of class names in the autoload process. (Dmitry) + . Fixed invalid C code in zend_strtod.c. (Lior Kaplan) + . Fixed bug #66041 (list() fails to unpack yielded ArrayAccess object). + (Nikita) + . Fixed bug #65764 (generators/throw_rethrow FAIL with + ZEND_COMPILE_EXTENDED_INFO). (Nikita) + . Fixed bug #61645 (fopen and O_NONBLOCK). (Mike) + . Fixed bug #66218 (zend_register_functions breaks reflection). (Remi) + +- Date: + . Fixed bug #66060 (Heap buffer over-read in DateInterval). (Remi) + . Fixed bug #65768 (DateTimeImmutable::diff does not work). (Nikita Nefedov) + +- DOM: + . Fixed bug #65196 (Passing DOMDocumentFragment to DOMDocument::saveHTML() + Produces invalid Markup). (Mike) + +- Exif: + . Fixed bug #65873 (Integer overflow in exif_read_data()). (Stas) + +- Filter: + . Fixed bug #66229 (128.0.0.0/16 isn't reserved any longer). (Adam) + +- GD: + . Fixed bug #64405 (Use freetype-config for determining freetype2 dir(s)). + (Adam) + +- PDO_odbc: + . Fixed bug #66311 (Stack smashing protection kills PDO/ODBC queries). + (michael at orlitzky dot com) + +- MySQLi: + . Fixed bug #65486 (mysqli_poll() is broken on win x64). (Anatol) + +- OPCache: + . Fixed reavlidate_path=1 behavior to avoid caching of symlinks values. + (Dmitry) + +- SNMP: + . Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin) + +- SOAP + . Fixed bug #66112 (Use after free condition in SOAP extension). + (martin dot koegler at brz dot gv dot at) + +- Sockets: + . Fixed bug #65923 (ext/socket assumes AI_V4MAPPED is defined). (Felipe) + +- XSL + . Fixed bug #49634 (Segfault throwing an exception in a XSL registered + function). (Mike) + +- ZIP: + . Fixed Bug #66321 (ZipArchive::open() ze_obj->filename_len not real). (Remi) + +12 Dec 2013, PHP 5.5.7 + - DBA: . Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike) - XSL: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 52ce26c..7c0ce3a 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -879,7 +879,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri return FAILURE; } -static inline int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) +int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC) { if (ZCG(accel_directives).revalidate_freq && (persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) { diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 4067558..b96d5c7 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -339,8 +339,8 @@ extern char *zps_api_failure_reason; void accel_shutdown(TSRMLS_D); void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); +int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC); int zend_accel_invalidate(const char *filename, zend_size_t filename_len, zend_bool force TSRMLS_DC); -int zend_accel_script_optimize(zend_persistent_script *persistent_script TSRMLS_DC); int accelerator_shm_read_lock(TSRMLS_D); void accelerator_shm_read_unlock(TSRMLS_D); diff --git a/ext/opcache/tests/issue0140.phpt b/ext/opcache/tests/issue0140.phpt new file mode 100644 index 0000000..7c0d6b9 --- /dev/null +++ b/ext/opcache/tests/issue0140.phpt @@ -0,0 +1,43 @@ +--TEST-- +Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq" +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.revalidate_freq=0 +opcache.file_update_protection=0 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> +--FILE-- +<?php +define("FILENAME", dirname(__FILE__) . "/issuer0140.inc.php"); +file_put_contents(FILENAME, "1\n"); + +var_dump(is_readable(FILENAME)); +include(FILENAME); +var_dump(filemtime(FILENAME)); + +sleep(2); +file_put_contents(FILENAME, "2\n"); + +var_dump(is_readable(FILENAME)); +include(FILENAME); +var_dump(filemtime(FILENAME)); + +sleep(2); +unlink(FILENAME); + +var_dump(is_readable(FILENAME)); +var_dump(@include(FILENAME)); +var_dump(@filemtime(FILENAME)); +?> +--EXPECTF-- +bool(true) +1 +int(%d) +bool(true) +2 +int(%d) +bool(false) +bool(false) +bool(false) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 86597bb..524e280 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -313,13 +313,15 @@ static int filename_is_in_cache(char *filename, zend_size_t filename_len TSRMLS_ if (IS_ABSOLUTE_PATH(filename, filename_len)) { persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1); if (persistent_script) { - return !persistent_script->corrupted; + return !persistent_script->corrupted && + validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; } } if ((key = accel_make_persistent_key_ex(&handle, filename_len, &key_length TSRMLS_CC)) != NULL) { persistent_script = zend_accel_hash_find(&ZCSG(hash), key, key_length + 1); - return persistent_script && !persistent_script->corrupted; + return persistent_script && !persistent_script->corrupted && + validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS; } return 0;

« previous php.cvs (#75419) next »