mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Fixed Issue #140: "opcache.enable_file_override" doesn't respect "opcache.revalidate_freq"
This commit is contained in:
parent
704866d6fd
commit
0dcaf0f445
2
NEWS
2
NEWS
@ -41,6 +41,8 @@ PHP NEWS
|
|||||||
- OPCache:
|
- OPCache:
|
||||||
. Fixed reavlidate_path=1 behavior to avoid caching of symlinks values.
|
. Fixed reavlidate_path=1 behavior to avoid caching of symlinks values.
|
||||||
(Dmitry)
|
(Dmitry)
|
||||||
|
. Fixed Issue #140: "opcache.enable_file_override" doesn't respect
|
||||||
|
"opcache.revalidate_freq". (Dmitry).
|
||||||
|
|
||||||
- SNMP:
|
- SNMP:
|
||||||
. Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin)
|
. Fixed SNMP_ERR_TOOBIG handling for bulk walk operations. (Boris Lytochkin)
|
||||||
|
@ -877,7 +877,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
|
|||||||
return FAILURE;
|
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 &&
|
if (ZCG(accel_directives).revalidate_freq &&
|
||||||
(persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
|
(persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
|
||||||
|
@ -330,6 +330,7 @@ extern char *zps_api_failure_reason;
|
|||||||
void accel_shutdown(TSRMLS_D);
|
void accel_shutdown(TSRMLS_D);
|
||||||
void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC);
|
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);
|
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 zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC);
|
||||||
int accelerator_shm_read_lock(TSRMLS_D);
|
int accelerator_shm_read_lock(TSRMLS_D);
|
||||||
void accelerator_shm_read_unlock(TSRMLS_D);
|
void accelerator_shm_read_unlock(TSRMLS_D);
|
||||||
|
43
ext/opcache/tests/issue0140.phpt
Normal file
43
ext/opcache/tests/issue0140.phpt
Normal file
@ -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)
|
@ -313,13 +313,15 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)
|
|||||||
if (IS_ABSOLUTE_PATH(filename, filename_len)) {
|
if (IS_ABSOLUTE_PATH(filename, filename_len)) {
|
||||||
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1);
|
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1);
|
||||||
if (persistent_script) {
|
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) {
|
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);
|
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;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user