com php-src: Fixed bug #69281 (opcache_is_script_cached no longer works): NEWS ext/opcache/tests/bug6 9281.phpt ext/opcache/tests/is_script_cached.
phpt ext/opcache/zend_accelerator_module.c
| From: | Xinchen Hui | Date: | Wed, 01 Apr 2015 15:58:22 +0000 |
| Subject: | com php-src: Fixed bug #69281 (opcache_is_script_cached no longer works): NEWS ext/opcache/tests/bug6 9281.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-86042@lists.php.net to get a copy of this message | ||
Commit: 86f983bd3ea13def42e36842e03f785d02d40a7f
Author: Danack <Danack@basereality.com> Wed, 1 Apr 2015 23:58:22 +0800
Committer: Xinchen Hui <laruence@php.net> Wed, 1 Apr 2015 23:58:22 +0800
Parents: 59c2a55ec7cbc70cc0227a127d3859fdc95566e7
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=86f983bd3ea13def42e36842e03f785d02d40a7f
Log:
Fixed bug #69281 (opcache_is_script_cached no longer works)
Bugs:
https://bugs.php.net/69281
Changed paths:
M NEWS
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/NEWS b/NEWS
index 6fcc697...fc4544c 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP NEWS
. Fixed bug #68740 (NULL Pointer Dereference). (Laruence)
- OPCache:
+ . Fixed bug #69281 (opcache_is_script_cached no longer works). (danack)
. Fixed bug #68677 (Use After Free). (CVE-2015-1351) (Laruence)
?? ??? 2015, PHP 5.5.24
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 e29ff00..3a6da3c 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -320,14 +320,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;