Skip to content

Commit 9ad870a

Browse files
committed
Allow empty HashTable
1 parent 610ca73 commit 9ad870a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Zend/zend_API.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,8 +1870,9 @@ ZEND_API zend_result object_init_with_constructor(zval *arg, zend_class_entry *c
18701870
}
18711871

18721872
/* 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)) {
1873+
* However, if there are named arguments (and it is not empty),
1874+
* an Error must be thrown to be consistent with new ClassName() */
1875+
if (UNEXPECTED(named_params != NULL && zend_hash_num_elements(named_params) != 0)) {
18751876
/* Throw standard Error */
18761877
zend_string *arg_name = NULL;
18771878
zend_hash_get_current_key(named_params, &arg_name, /* num_index */ NULL);

0 commit comments

Comments
 (0)