summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-05-12 13:16:07 +0800
committerXinchen Hui <laruence@gmail.com>2016-05-12 13:16:07 +0800
commitd1926742aa5e766979ff892055b6ea7960ad809e (patch)
tree309427d8e07b6a1d0b5581d88c96ee3b7182d294
parent3c0341e6f9c802ff50cc4eb08e6b90793d033aad (diff)
parenta73b03edea9b988e079b3c8c2018321e834ff78f (diff)
downloadphp-git-d1926742aa5e766979ff892055b6ea7960ad809e.tar.gz
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: Fix serializing ZEND_AST_SHELL_EXEC add missing NEWS entry prepare for 5.6.22RC1 add missing NEWS entry
-rw-r--r--Zend/tests/ast_serialize_backtick_literal.phpt11
-rw-r--r--Zend/zend_ast.c6
2 files changed, 16 insertions, 1 deletions
diff --git a/Zend/tests/ast_serialize_backtick_literal.phpt b/Zend/tests/ast_serialize_backtick_literal.phpt
new file mode 100644
index 0000000000..03bdc298ac
--- /dev/null
+++ b/Zend/tests/ast_serialize_backtick_literal.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Serialization of backtick literal is incorrect
+--INI--
+zend.assertions=1
+--FILE--
+<?php
+
+assert_options(ASSERT_WARNING);
+assert(false && `echo -n ""`);
+--EXPECTF--
+Warning: assert(): assert(false && `echo -n ""`) failed in %s/ast_serialize_backtick_literal.php on line 4
diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c
index 3772887092..11980f10ee 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -1217,7 +1217,11 @@ simple_list:
if (ast->child[0]->kind == ZEND_AST_ENCAPS_LIST) {
zend_ast_export_encaps_list(str, '`', (zend_ast_list*)ast->child[0], indent);
} else {
- zend_ast_export_ex(str, ast->child[0], 0, indent);
+ zval *zv;
+ ZEND_ASSERT(ast->child[0]->kind == ZEND_AST_ZVAL);
+ zv = zend_ast_get_zval(ast->child[0]);
+ ZEND_ASSERT(Z_TYPE_P(zv) == IS_STRING);
+ zend_ast_export_qstr(str, '`', Z_STR_P(zv));
}
smart_str_appendc(str, '`');
break;