From d455377fad13156b85db957a9419d7aefcbc0040 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sun, 22 Dec 2013 13:20:17 +0000 Subject: [PATCH 1/4] opcodes --- Zend/zend_vm_opcodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index ed02663c46c..d334e451366 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -171,4 +171,4 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); #define ZEND_FAST_RET 163 #define ZEND_RECV_VARIADIC 164 -#endif +#endif \ No newline at end of file From 704866d6fdbccb74ecf2a4feb54ce7787bdf0c16 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sun, 22 Dec 2013 13:20:41 +0000 Subject: [PATCH 2/4] opcodes --- Zend/zend_vm_opcodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index aa917c18b2d..adbf593d716 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -170,4 +170,4 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); #define ZEND_FAST_CALL 162 #define ZEND_FAST_RET 163 -#endif +#endif \ No newline at end of file From ee55edf5e41b695f781d36a808664e42d6a3dcd0 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sun, 22 Dec 2013 13:30:41 +0000 Subject: [PATCH 3/4] fix news --- NEWS | 3 --- 1 file changed, 3 deletions(-) diff --git a/NEWS b/NEWS index 1f971a0223f..fecf78ceb7c 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,6 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -<<<<<<< HEAD ?? ??? 20??, PHP 5.6.0 -======= -?? ??? 2013, PHP 5.5.8 - Core: . Disallowed JMP into a finally block. (Laruence) From 0dcaf0f445a4084f3dbb37411b6acead4658c5f5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 23 Dec 2013 12:46:30 +0400 Subject: [PATCH 4/4] Fixed Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq" --- NEWS | 2 ++ ext/opcache/ZendAccelerator.c | 2 +- ext/opcache/ZendAccelerator.h | 1 + ext/opcache/tests/issue0140.phpt | 43 +++++++++++++++++++++++++++ ext/opcache/zend_accelerator_module.c | 6 ++-- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 ext/opcache/tests/issue0140.phpt diff --git a/NEWS b/NEWS index 81cd742733a..38659e60767 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,8 @@ PHP NEWS - OPCache: . Fixed reavlidate_path=1 behavior to avoid caching of symlinks values. (Dmitry) + . Fixed Issue #140: "opcache.enable_file_override" doesn't respect + "opcache.revalidate_freq". (Dmitry). - SNMP: . Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index be562359297..9662c9912cc 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -877,7 +877,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 cbc50d2b71e..dbda3b3822c 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -330,6 +330,7 @@ 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, int filename_len, zend_bool force 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 00000000000..7c0d6b92b31 --- /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-- + + +--FILE-- + +--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 c3df1a68f78..36d02cc0722 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, int filename_len TSRMLS_DC) 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;