From 59522c5a85d0f87679dce05f5a0247deb59e1ba3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 1 Jul 2019 16:25:28 +0200 Subject: [PATCH] Generate less code in compile time binary op test Don't generate try {} blocks for the operations that don't throw. --- Zend/tests/runtime_compile_time_binary_operands.phpt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Zend/tests/runtime_compile_time_binary_operands.phpt b/Zend/tests/runtime_compile_time_binary_operands.phpt index 897ce3e1a5..afced7af0c 100644 --- a/Zend/tests/runtime_compile_time_binary_operands.phpt +++ b/Zend/tests/runtime_compile_time_binary_operands.phpt @@ -108,16 +108,16 @@ function prepareLine($op1, $op2, $cmp, $operator) { $error = "echo '" . addcslashes("$op1_p $operator $op2_p", "\\'") . '\', "\n"; $f++;'; $compare = "@($op1_p $operator $op2_p)"; - $line = "\$c++; try { "; + $line = "\$c++; "; try { $result = makeParam($cmp()); - $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error } } catch (Error \$e) { $error }"; + $line .= "if (" . ($result === "(NAN)" ? "!is_nan($compare)" : "$compare !== $result") . ") { $error }"; } catch (Error $e) { if (get_class($e) == "Error") { return "// exempt $op1_p $operator $op2_p from checking, it generates a compile time error"; } $msg = makeParam($e->getMessage()); - $line .= "$compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }"; + $line .= "try { $compare; $error } catch (Error \$e) { if (\$e->getMessage() !== $msg) { $error } }"; } return $line; } @@ -130,7 +130,10 @@ fwrite($file, "