diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-06-06 01:47:22 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-06-06 01:47:22 +0300 |
commit | 457392fa64692be0927ed641369370f02afb0420 (patch) | |
tree | e83d85fadb66cffa22fc119d3df60e72f2f9a007 /ext/mysqli | |
parent | 90a2e4ba668e89e59301abfe71175b0c0d1f9b96 (diff) | |
download | php-git-457392fa64692be0927ed641369370f02afb0420.tar.gz |
Cheaper checks for exceptions thrown from __toString()
Diffstat (limited to 'ext/mysqli')
-rw-r--r-- | ext/mysqli/mysqli.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 9964ea0be4..1d56c1ab60 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -307,11 +307,12 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl obj = Z_MYSQLI_P(object); if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - if (EG(exception)) { + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { return &EG(uninitialized_zval); } + ZVAL_STR(&tmp_member, str); + member = &tmp_member; } if (obj->prop_handler != NULL) { @@ -343,11 +344,12 @@ zval *mysqli_write_property(zval *object, zval *member, zval *value, void **cach mysqli_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); - member = &tmp_member; - if (EG(exception)) { + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { return value; } + ZVAL_STR(&tmp_member, str); + member = &tmp_member; } obj = Z_MYSQLI_P(object); |