summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanack <Danack@basereality.com>2015-04-01 23:58:22 +0800
committerFerenc Kovacs <tyrael@php.net>2015-04-03 09:27:48 +0200
commite0e19a12be4aaaedbb7862a0b257bdc901542f57 (patch)
tree5657dd0c84f01903bf7d1629814049904c6dfe9f
parenta6601cb692fca35b65d6fe0447c63fb6d57708ad (diff)
downloadphp-git-e0e19a12be4aaaedbb7862a0b257bdc901542f57.tar.gz
Fixed bug #69281 (opcache_is_script_cached no longer works)
-rw-r--r--ext/opcache/tests/bug69281.phpt17
-rw-r--r--ext/opcache/tests/is_script_cached.phpt1
-rw-r--r--ext/opcache/zend_accelerator_module.c6
3 files changed, 22 insertions, 2 deletions
diff --git a/ext/opcache/tests/bug69281.phpt b/ext/opcache/tests/bug69281.phpt
new file mode 100644
index 0000000000..4d68d5007b
--- /dev/null
+++ b/ext/opcache/tests/bug69281.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test that script cached info is correct with validate_timestamps disabled
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.validate_timestamps=0
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+var_dump(opcache_is_script_cached(__FILE__));
+var_dump(opcache_is_script_cached("nonexistent.php"));
+?>
+--EXPECT--
+bool(true)
+bool(false)
diff --git a/ext/opcache/tests/is_script_cached.phpt b/ext/opcache/tests/is_script_cached.phpt
index 0560e98d88..bac561103f 100644
--- a/ext/opcache/tests/is_script_cached.phpt
+++ b/ext/opcache/tests/is_script_cached.phpt
@@ -4,6 +4,7 @@ Test that script cached info is correct
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
+opcache.validate_timestamps=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 979a730238..f7715a266b 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -324,14 +324,16 @@ static int filename_is_in_cache(char *filename, int filename_len TSRMLS_DC)
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename, filename_len + 1);
if (persistent_script) {
return !persistent_script->corrupted &&
- validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
+ (!ZCG(accel_directives).validate_timestamps ||
+ 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 &&
- validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS;
+ (!ZCG(accel_directives).validate_timestamps ||
+ validate_timestamp_and_record(persistent_script, &handle TSRMLS_CC) == SUCCESS);
}
return 0;