diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-29 11:29:24 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-07-29 11:29:49 +0200 |
| commit | 993be4b9bf34b2d1a7c288599b0e011aa9f33906 (patch) | |
| tree | 6df4e9a6683173a50a058ddfd668c188fc6e4842 /Zend/zend_API.h | |
| parent | 213494f55d7e4f8508ea6f0892d9ad8172783ee3 (diff) | |
| download | php-git-993be4b9bf34b2d1a7c288599b0e011aa9f33906.tar.gz | |
Fix STR_OR_OBJ_OF_TYPE stringable handling
Diffstat (limited to 'Zend/zend_API.h')
| -rw-r--r-- | Zend/zend_API.h | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 46b7f26190..7733d18584 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -2014,24 +2014,15 @@ static zend_always_inline int zend_parse_arg_str_or_obj( zval *arg, zend_string **destination_string, zend_object **destination_object, zend_class_entry *base_ce, int allow_null ) { if (EXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { - if (base_ce && UNEXPECTED(!instanceof_function(Z_OBJCE_P(arg), base_ce))) { - return 0; + if (!base_ce || EXPECTED(instanceof_function(Z_OBJCE_P(arg), base_ce))) { + *destination_string = NULL; + *destination_object = Z_OBJ_P(arg); + return 1; } - - *destination_string = NULL; - *destination_object = Z_OBJ_P(arg); - } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { - *destination_string = Z_STR_P(arg); - *destination_object = NULL; - } else if (allow_null && EXPECTED(Z_TYPE_P(arg) == IS_NULL)) { - *destination_string = NULL; - *destination_object = NULL; - } else { - *destination_object = NULL; - return zend_parse_arg_str_slow(arg, destination_string); } - return 1; + *destination_object = NULL; + return zend_parse_arg_str(arg, destination_string, allow_null); } END_EXTERN_C() |
