8000 Store default values of parameters of internal functions in arginfo by kocsismate · Pull Request #5353 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

Store default values of parameters of internal functions in arginfo #5353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Prev Previous commit
Initialize file context
  • Loading branch information
nikic committed Apr 8, 2020
commit dd62bcdcbb3569fcc68ecc477451b286807cf30c
3 changes: 3 additions & 0 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,12 +1314,15 @@ static int get_default_via_ast(zval *default_value_zval, const char *default_val

zend_arena *original_ast_arena = CG(ast_arena);
uint32_t original_compiler_options = CG(compiler_options);
zend_file_context original_file_context;
CG(ast_arena) = ast_arena;
/* Disable constant substitution, to make getDefaultValueConstant() work. */
CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION | ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION;
zend_file_context_begin(&original_file_context);
zend_const_expr_to_zval(default_value_zval, const_expression_ast);
CG(ast_arena) = original_ast_arena;
CG(compiler_options) = original_compiler_options;
zend_file_context_end(&original_file_context);

zend_ast_destroy(ast);
zend_arena_destroy(ast_arena);
Expand Down
0