@@ -1867,24 +1867,24 @@ ZEND_API zend_result object_init_with_constructor(zval *arg, zend_class_entry *c
1867
1867
zval_ptr_dtor (arg );
1868
1868
ZVAL_UNDEF (arg );
1869
1869
return FAILURE ;
1870
+ }
1871
+
1872
+ /* Surprisingly, this is the only case where internal classes will allow to pass extra arguments
1873
+ * However, if there are named arguments, an Error must be thrown to be consistent with new ClassName() */
1874
+ if (UNEXPECTED (named_params != NULL )) {
1875
+ /* Throw standard Error */
1876
+ zend_string * arg_name = NULL ;
1877
+ zend_hash_get_current_key (named_params , & arg_name , /* num_index */ NULL );
1878
+ ZEND_ASSERT (arg_name != NULL );
1879
+ zend_throw_error (NULL , "Unknown named parameter $%s" , ZSTR_VAL (arg_name ));
1880
+ zend_string_release (arg_name );
1881
+ /* Do not call destructor, free object, and set arg to IS_UNDEF */
1882
+ zend_object_store_ctor_failed (obj );
1883
+ zval_ptr_dtor (arg );
1884
+ ZVAL_UNDEF (arg );
1885
+ return FAILURE ;
1870
1886
} else {
1871
- /* Surprisingly, this is the only case where internal classes will allow to pass extra arguments
1872
- * However, if there are named arguments, an Error must be thrown to be consistent with new ClassName() */
1873
- if (UNEXPECTED (named_params != NULL )) {
1874
- /* Throw standard Error */
1875
- zend_string * arg_name = NULL ;
1876
- zend_hash_get_current_key (named_params , & arg_name , /* num_index */ NULL );
1877
- ZEND_ASSERT (arg_name != NULL );
1878
- zend_throw_error (NULL , "Unknown named parameter $%s" , ZSTR_VAL (arg_name ));
1879
- zend_string_release (arg_name );
1880
- /* Do not call destructor, free object, and set arg to IS_UNDEF */
1881
- zend_object_store_ctor_failed (obj );
1882
- zval_ptr_dtor (arg );
1883
- ZVAL_UNDEF (arg );
1884
- return FAILURE ;
1885
- } else {
1886
- return SUCCESS ;
1887
- }
1887
+ return SUCCESS ;
1888
1888
}
1889
1889
}
1890
1890
/* A constructor should not return a value, however if an exception is thrown
@@ -1894,7 +1894,7 @@ ZEND_API zend_result object_init_with_constructor(zval *arg, zend_class_entry *c
1894
1894
constructor ,
1895
1895
obj ,
1896
1896
class_type ,
1897
- /* retval */ & retval ,
1897
+ & retval ,
1898
1898
param_count ,
1899
1899
params ,
1900
1900
named_params
0 commit comments