diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-03-31 12:17:32 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-03-31 14:37:49 +0200 |
commit | 8fd7f02ea4cd595a792ef37e558d357d97bceefa (patch) | |
tree | a4684263d41cf407f5cffb725fe319bbc05da75c /Zend/zend_API.c | |
parent | 36935e42eac054a422b7edade69923db7727f268 (diff) | |
download | php-git-8fd7f02ea4cd595a792ef37e558d357d97bceefa.tar.gz |
Make cast_object handler required
Avoid subtle differences in behavior depending on whether the
handler is absent or returns FAILURE.
If you previously set cast_object to NULL, create a handler that
always returns FAILURE instead.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index acb4366527..00b8076b3d 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -472,15 +472,12 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest *dest = Z_STR_P(arg); } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { zend_object *zobj = Z_OBJ_P(arg); - - if (Z_OBJ_HANDLER_P(arg, cast_object)) { - zval obj; - if (zobj->handlers->cast_object(zobj, &obj, IS_STRING) == SUCCESS) { - OBJ_RELEASE(zobj); - ZVAL_COPY_VALUE(arg, &obj); - *dest = Z_STR_P(arg); - return 1; - } + zval obj; + if (zobj->handlers->cast_object(zobj, &obj, IS_STRING) == SUCCESS) { + OBJ_RELEASE(zobj); + ZVAL_COPY_VALUE(arg, &obj); + *dest = Z_STR_P(arg); + return 1; } return 0; } else { |