Skip to content

Commit df7db65

Browse files
committed
Merge remote-tracking branch 'origin/master' into str_size_and_int64
2 parents 74aea4e + b11b3d2 commit df7db65

File tree

6 files changed

+73
-11
lines changed

6 files changed

+73
-11
lines changed

Zend/zend_extensions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/* The first number is the engine version and the rest is the date.
2929
* This way engine 2/3 API no. is always greater than engine 1 API no..
3030
*/
31-
#define ZEND_EXTENSION_API_NO 220131107
31+
#define ZEND_EXTENSION_API_NO 220131218
3232

3333
typedef struct _zend_extension_version_info {
3434
int zend_extension_api_no;

ext/opcache/Optimizer/block_pass.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
14651465
case ZEND_JMPNZ:
14661466
/* constant conditional JMPs */
14671467
if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
1468-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
1468+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
14691469
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC);
14701470
#else
14711471
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
@@ -1613,7 +1613,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
16131613
case ZEND_JMPZ_EX:
16141614
/* constant conditional JMPs */
16151615
if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
1616-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
1616+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
16171617
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC);
16181618
#else
16191619
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(last_op));
@@ -1739,7 +1739,7 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
17391739
}
17401740

17411741
if (ZEND_OP1_TYPE(last_op) == IS_CONST) {
1742-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
1742+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
17431743
if (!zend_is_true(&ZEND_OP1_LITERAL(last_op) TSRMLS_CC)) {
17441744
#else
17451745
if (!zend_is_true(&ZEND_OP1_LITERAL(last_op))) {

ext/opcache/Optimizer/pass2.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
8989
/* convert Ti = JMPZ_EX(C, L) => Ti = QM_ASSIGN(C)
9090
in case we know it wouldn't jump */
9191
} else if (ZEND_OP1_TYPE(opline) == IS_CONST) {
92-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
92+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
9393
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC);
9494
#else
9595
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
@@ -107,7 +107,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
107107
case ZEND_JMPZ:
108108
case ZEND_JMPNZ:
109109
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
110-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
110+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
111111
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC);
112112
#else
113113
int should_jmp = zend_is_true(&ZEND_OP1_LITERAL(opline));
@@ -147,7 +147,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) {
147147
case ZEND_JMPZNZ:
148148
if (ZEND_OP1_TYPE(opline) == IS_CONST) {
149149
int opline_num;
150-
#if PHP_API_VERSION > PHP_5_6_X_API_NO
150+
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
151151
if (zend_is_true(&ZEND_OP1_LITERAL(opline) TSRMLS_CC)) {
152152
#else
153153
if (zend_is_true(&ZEND_OP1_LITERAL(opline))) {

ext/opcache/ZendAccelerator.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,9 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
11591159
zend_persistent_script *existing_persistent_script = (zend_persistent_script *)bucket->data;
11601160

11611161
if (!existing_persistent_script->corrupted) {
1162-
if (!ZCG(accel_directives).validate_timestamps ||
1163-
(new_persistent_script->timestamp == existing_persistent_script->timestamp)) {
1162+
if (!ZCG(accel_directives).revalidate_path &&
1163+
(!ZCG(accel_directives).validate_timestamps ||
1164+
(new_persistent_script->timestamp == existing_persistent_script->timestamp))) {
11641165
zend_accel_add_key(key, key_length, bucket TSRMLS_CC);
11651166
}
11661167
zend_shared_alloc_unlock(TSRMLS_C);
@@ -1201,7 +1202,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
12011202

12021203
/* store script structure in the hash table */
12031204
bucket = zend_accel_hash_update(&ZCSG(hash), new_persistent_script->full_path, new_persistent_script->full_path_len + 1, 0, new_persistent_script);
1204-
if (bucket &&
1205+
if (bucket && !ZCG(accel_directives).revalidate_path &&
12051206
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
12061207
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
12071208
(new_persistent_script->full_path_len != key_length ||
+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
--TEST--
2+
revalidate_path 01: OPCache must cache only resolved real paths when revalidate_path is set
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.revalidate_path=1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?>
10+
--FILE--
11+
<?php
12+
$dir = dirname(__FILE__);
13+
$dir1 = "$dir/test1";
14+
$dir2 = "$dir/test2";
15+
$link = "$dir/test";
16+
$file1 = "$dir1/index.php";
17+
$file2 = "$dir2/index.php";
18+
$main = "$dir/main.php";
19+
@mkdir($dir1);
20+
@mkdir($dir2);
21+
@file_put_contents($main, '<?php include(\'' . $link .'/index.php\');');
22+
@file_put_contents($file1, "TEST 1\n");
23+
@file_put_contents($file2, "TEST 2\n");
24+
while (filemtime($file1) != filemtime($file2)) {
25+
touch($file1);
26+
touch($file2);
27+
}
28+
@unlink($link);
29+
@symlink($dir1, $link);
30+
31+
include "php_cli_server.inc";
32+
//php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1');
33+
php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_path=1 -d opcache.file_update_protection=0 -d realpath_cache_size=0');
34+
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
35+
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
36+
@unlink($link);
37+
@symlink($dir2, $link);
38+
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
39+
echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/main.php');
40+
?>
41+
--CLEAN--
42+
<?php
43+
$dir = dirname(__FILE__);
44+
$dir1 = "$dir/test1";
45+
$dir2 = "$dir/test2";
46+
$link = "$dir/test";
47+
$file1 = "$dir1/index.php";
48+
$file2 = "$dir2/index.php";
49+
$main = "$dir/main.php";
50+
@unlink($main);
51+
@unlink($link);
52+
@unlink($file1);
53+
@unlink($file2);
54+
@rmdir($dir1);
55+
@rmdir($dir2);
56+
?>
57+
--EXPECT--
58+
TEST 1
59+
TEST 1
60+
TEST 2
61+
TEST 2

main/php.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <dmalloc.h>
2727
#endif
2828

29-
#define PHP_API_VERSION 20131106
29+
#define PHP_API_VERSION 20131218
3030
#define PHP_HAVE_STREAMS
3131
#define YYDEBUG 0
3232

0 commit comments

Comments
 (0)