com php-src: Fixed bug #66474 (Optimizer bug in constant string to boolean conversion): NEWS ext/opcache/Optimizer/block_pass.c ext/
opcache/tests/bug66474.phpt
| From: | Dmitry Stogov | Date: | Mon, 13 Jan 2014 08:06:19 +0000 |
| Subject: | com php-src: Fixed bug #66474 (Optimizer bug in constant string to boolean conversion): NEWS ext/opcache/Optimizer/block_pass.c ext/ opcache/tests/bug66474.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75577@lists.php.net to get a copy of this message | ||
Commit: fcd75690fe68c11ff9a327ee2e1ce3646b032431
Author: Dmitry Stogov <dmitry@zend.com> Mon, 13 Jan 2014 12:06:19 +0400
Parents: 98e06a10d354149995e3b9dc2b0932d98ee5b561
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fcd75690fe68c11ff9a327ee2e1ce3646b032431
Log:
Fixed bug #66474 (Optimizer bug in constant string to boolean conversion)
Bugs:
https://bugs.php.net/66474
Changed paths:
M NEWS
M ext/opcache/Optimizer/block_pass.c
A ext/opcache/tests/bug66474.phpt
Diff:
diff --git a/NEWS b/NEWS
index 5979ab1..07a9e7f 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP NEWS
(Laruence, Remi)
- OPCache:
+ . Fixed bug #66474 (Optimizer bug in constant string to boolean conversion).
+ (Dmitry)
. Fixed bug #66298 (ext/opcache/Optimizer/zend_optimizer.c has dos-style
^M as lineend). (Laruence)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 8c4c58e..79eee8b 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -1057,6 +1057,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array
*op_array,
/* BOOL */
result = ZEND_OP1_LITERAL(opline);
convert_to_boolean(&result);
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) = IS_NULL;
}
PZ_SET_REFCOUNT_P(&result, 1);
PZ_UNSET_ISREF_P(&result);
diff --git a/ext/opcache/tests/bug66474.phpt b/ext/opcache/tests/bug66474.phpt
new file mode 100644
index 0000000..3bd038c
--- /dev/null
+++ b/ext/opcache/tests/bug66474.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #66474 (Optimizer bug in constant string to boolean conversion)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.file_update_protection=0
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ $speed = 'slow' || 'fast';
+}
+foo();
+echo "ok\n";
+--EXPECT--
+ok