From fcd75690fe68c11ff9a327ee2e1ce3646b032431 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 13 Jan 2014 12:06:19 +0400 Subject: [PATCH] Fixed bug #66474 (Optimizer bug in constant string to boolean conversion) --- NEWS | 2 ++ ext/opcache/Optimizer/block_pass.c | 1 + ext/opcache/tests/bug66474.phpt | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 ext/opcache/tests/bug66474.phpt diff --git a/NEWS b/NEWS index 5979ab1e43..07a9e7f864 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 8c4c58e493..79eee8bcc1 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 0000000000..3bd038c0de --- /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-- + +--FILE-- +