@@ -9808,6 +9808,44 @@ ZEND_VM_HANDLER(209, ZEND_INIT_PARENT_PROPERTY_HOOK_CALL, CONST, UNUSED|NUM, NUM
9808
9808
ZEND_VM_NEXT_OPCODE ();
9809
9809
}
9810
9810
9811
+ ZEND_VM_HANDLER (210 , ZEND_FETCH_DEFAULT_ARG , UNUSED , UNUSED )
9812
+ {
9813
+ USE_OPLINE
9814
+ SAVE_OPLINE ();
9815
+
9816
+ zend_function * called_func = EX (call )-> func ;
9817
+
9818
+ zend_string * reflection_class_name = ZSTR_INIT_LITERAL ("ReflectionParameter" , 0 );
9819
+ zend_class_entry * reflection_class = zend_fetch_class (reflection_class_name , ZEND_FETCH_CLASS_DEFAULT );
9820
+ zend_string_release (reflection_class_name );
9821
+
9822
+ /*
9823
+ * [0]: The function (string) or class method (array) to reflect parameters from.
9824
+ * [1]: A zero-based integer specifying the parameter position.
9825
+ */
9826
+ zval constructor_params [2 ];
9827
+ ZVAL_LONG (& constructor_params [1 ], opline -> op1 .num - 1 );
9828
+ if (called_func -> common .scope == NULL ) {
9829
+ ZVAL_STR_COPY (& constructor_params [0 ], called_func -> common .function_name );
9830
+ } else {
9831
+ zval arr ;
9832
+ array_init_size (& arr , 2 );
9833
+ add_next_index_string (& arr , called_func -> common .scope -> name -> val );
9834
+ add_next_index_string (& arr , called_func -> common .function_name -> val );
9835
+ ZVAL_ARR (& constructor_params [0 ], Z_ARR (arr ));
9836
+ }
9837
+
9838
+ zval reflection_obj ;
9839
+ // TODO: Check result.
9840
+ /*zend_result res =*/ object_init_with_constructor (& reflection_obj , reflection_class , 2 , constructor_params , NULL );
9841
+
9842
+ zval default_value ;
9843
+ zend_call_method_with_0_params (Z_OBJ (reflection_obj ), reflection_class , NULL , "getDefaultValue" , & default_value );
9844
+
9845
+ ZVAL_COPY_VALUE (EX_VAR (opline -> result .var ), & default_value );
9846
+ ZEND_VM_NEXT_OPCODE ();
9847
+ }
9848
+
9811
9849
ZEND_VM_HOT_TYPE_SPEC_HANDLER (ZEND_JMP , (OP_JMP_ADDR (op , op -> op1 ) > op ), ZEND_JMP_FORWARD , JMP_ADDR , ANY )
9812
9850
{
9813
9851
USE_OPLINE
0 commit comments