From: Sara Golemon Date: Thu, 12 May 2016 02:28:57 +0000 (+0000) Subject: Fix serializing ZEND_AST_SHELL_EXEC X-Git-Tag: php-7.0.8RC1~70^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a73b03edea9b988e079b3c8c2018321e834ff78f;p=php Fix serializing ZEND_AST_SHELL_EXEC Currently, `foo` is reserialized as `'foo'` due to misuse of zend_ast_export(). ZEND_AST_SHELL_EXEC can only contain ZEND_AST_ZVAL(string) or ZEND_AST_ENCAPS_LIST, so just handle the ZEND_AST_ZVAL(string) case directly. --- 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-- +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;