summaryrefslogtreecommitdiff
path: root/ext/simplexml
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2019-06-06 02:23:17 +0300
committerDmitry Stogov <dmitry@zend.com>2019-06-06 02:23:17 +0300
commite029cc4dd45c4ee5ab6678d6c732df9ed17b06d0 (patch)
tree20c4ac0d20f4f996c9436b40316048de1c106a44 /ext/simplexml
parentb4d21310cb965e50b00d02dcb4d5b2afb0521424 (diff)
parent457392fa64692be0927ed641369370f02afb0420 (diff)
downloadphp-git-e029cc4dd45c4ee5ab6678d6c732df9ed17b06d0.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Cheaper checks for exceptions thrown from __toString()
Diffstat (limited to 'ext/simplexml')
-rw-r--r--ext/simplexml/simplexml.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index c21b6dad24..bb8dfb3766 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -258,11 +258,12 @@ long_dim:
name = NULL;
} else {
if (Z_TYPE_P(member) != IS_STRING) {
- ZVAL_STR(&tmp_zv, zval_get_string_func(member));
- member = &tmp_zv;
- if (EG(exception)) {
+ zend_string *str = zval_try_get_string_func(member);
+ if (UNEXPECTED(!str)) {
return &EG(uninitialized_zval);
}
+ ZVAL_STR(&tmp_zv, str);
+ member = &tmp_zv;
}
name = Z_STRVAL_P(member);
}
@@ -459,8 +460,8 @@ long_dim:
}
} else {
if (Z_TYPE_P(member) != IS_STRING) {
- trim_str = zval_get_string_func(member);
- if (EG(exception)) {
+ trim_str = zval_try_get_string_func(member);
+ if (UNEXPECTED(!trim_str)) {
return &EG(error_zval);
}
@@ -726,11 +727,12 @@ static int sxe_prop_dim_exists(zend_object *object, zval *member, int check_empt
zval tmp_zv;
if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- ZVAL_STR(&tmp_zv, zval_get_string_func(member));
- member = &tmp_zv;
- if (EG(exception)) {
+ zend_string *str = zval_try_get_string_func(member);
+ if (UNEXPECTED(!str)) {
return 0;
}
+ ZVAL_STR(&tmp_zv, str);
+ member = &tmp_zv;
}
sxe = php_sxe_fetch_object(object);
@@ -850,11 +852,12 @@ static void sxe_prop_dim_delete(zend_object *object, zval *member, zend_bool ele
int test = 0;
if (Z_TYPE_P(member) != IS_STRING && Z_TYPE_P(member) != IS_LONG) {
- ZVAL_STR(&tmp_zv, zval_get_string_func(member));
- member = &tmp_zv;
- if (EG(exception)) {
+ zend_string *str = zval_try_get_string_func(member);
+ if (UNEXPECTED(!str)) {
return;
}
+ ZVAL_STR(&tmp_zv, str);
+ member = &tmp_zv;
}
sxe = php_sxe_fetch_object(object);