@@ -1379,65 +1379,7 @@ static int _reflection_param_get_default_arg_info(zend_function *fptr, zend_arg_
1379
1379
return FAILURE ;
1380
1380
}
1381
1381
1382
- zval code_zv ;
1383
- zend_bool original_in_compilation ;
1384
- uint32_t original_compiler_options ;
1385
- zend_lex_state original_lex_state ;
1386
- zend_ast * ast ;
1387
- zend_arena * ast_arena ;
1388
- int success = FAILURE ;
1389
-
1390
- smart_str code = {0 };
1391
- smart_str_appends (& code , "<?php " );
1392
- if (fptr -> type == ZEND_INTERNAL_FUNCTION ) {
1393
- smart_str_appends (& code , ((zend_internal_arg_info * )arg_info )-> default_value );
1394
- } else {
1395
- smart_str_appends (& code , ZSTR_VAL (arg_info -> default_value ));
1396
- }
1397
- smart_str_appendc (& code , ';' );
1398
- smart_str_0 (& code );
1399
-
1400
- ZVAL_STR_COPY (& code_zv , code .s );
1401
- smart_str_free (& code );
1402
-
1403
- original_in_compilation = CG (in_compilation );
1404
- original_compiler_options = CG (compiler_options );
1405
- zend_save_lexical_state (& original_lex_state );
1406
-
1407
- CG (in_compilation ) = 1 ;
1408
- CG (compiler_options ) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION | ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION ;
1409
-
1410
- if (zend_prepare_string_for_scanning (& code_zv , "" ) == SUCCESS ) {
1411
- CG (ast ) = NULL ;
1412
- CG (ast_arena ) = zend_arena_create (1024 * 32 );
1413
- LANG_SCNG (yy_state ) = yycINITIAL ;
1414
-
1415
- if (zendparse () != 0 ) {
1416
- zend_ast_destroy (CG (ast ));
1417
- zend_arena_destroy (CG (ast_arena ));
1418
- CG (ast ) = NULL ;
1419
- }
1420
- }
1421
-
1422
- ast = CG (ast );
1423
- ast_arena = CG (ast_arena );
1424
-
1425
- if (ast ) {
1426
- zend_ast_list * statement_list = zend_ast_get_list (ast );
1427
- zend_ast * const_expression_ast = statement_list -> child [0 ];
1428
- if (const_expression_ast ) {
1429
- zend_const_expr_to_zval (default_value_zval , const_expression_ast );
1430
- success = SUCCESS ;
1431
- }
1432
- }
1433
-
1434
- zend_restore_lexical_state (& original_lex_state );
1435
- CG (compiler_options ) = original_compiler_options ;
1436
- CG (in_compilation ) = original_in_compilation ;
1437
-
1438
- zval_dtor (& code_zv );
1439
- zend_ast_destroy (ast );
1440
- zend_arena_destroy (ast_arena );
1382
+ int success = zend_eval_string (ZSTR_VAL (arg_info -> default_value ), default_value_zval , "" );
1441
1383
1442
1384
if (success == FAILURE ) {
1443
1385
zend_throw_exception_ex (reflection_exception_ptr , 0 , "Internal error: Failed to retrieve the default value" );
0 commit comments