com php-src: Fixed bug #69281 (opcache_is_script_cached no longer works): ext/opcache/tests/bug692 81.phpt ext/opcache/tests/is_script_cached.phpt
ext/opcache/zend_accelerator_module.c
| From: | Ferenc Kovacs | Date: | Fri, 03 Apr 2015 07:27:48 +0000 |
| Subject: | com php-src: Fixed bug #69281 (opcache_is_script_cached no longer works): ext/opcache/tests/bug692 81.phpt ext/opcache/tests/is_script_cached.phpt ext/opcache/zend_accelerator_module.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86063@lists.php.net to get a copy of this message | ||
Commit: e0e19a12be4aaaedbb7862a0b257bdc901542f57
Author: Danack <Danack@basereality.com> Wed, 1 Apr 2015 23:58:22 +0800
Committer: Ferenc Kovacs <tyrael@php.net> Fri, 3 Apr 2015 09:27:48 +0200
Parents: a6601cb692fca35b65d6fe0447c63fb6d57708ad
Branches: PHP-5.6.8
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e0e19a12be4aaaedbb7862a0b257bdc901542f57
Log:
Fixed bug #69281 (opcache_is_script_cached no longer works)
Bugs:
https://bugs.php.net/69281
Changed paths:
A ext/opcache/tests/bug69281.phpt
M ext/opcache/tests/is_script_cached.phpt
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/tests/bug69281.phpt b/ext/opcache/tests/bug69281.phpt
new file mode 100644
index 0000000..4d68d50
--- /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 0560e98..bac5611 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 979a730..f7715a2 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;