Skip to content

Commit

Permalink
Use Zend API helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Sep 11, 2018
1 parent 1cc0d78 commit 83fe1f1
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions ext/soap/php_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -1174,31 +1174,10 @@ static void set_zval_property(zval* object, char* name, zval* val)
static zval* get_zval_property(zval* object, char* name, zval *rv)
{
if (Z_TYPE_P(object) == IS_OBJECT) {
zval member;
zval *data;
zend_class_entry *old_scope;

ZVAL_STRING(&member, name);
old_scope = EG(fake_scope);
EG(fake_scope) = Z_OBJCE_P(object);
data = Z_OBJ_HT_P(object)->read_property(object, &member, BP_VAR_IS, NULL, rv);
zval *data = zend_read_property(Z_OBJCE_P(object), object, name, strlen(name), 1, rv);
if (data == &EG(uninitialized_zval)) {
/* Hack for bug #32455 */
zend_property_info *property_info;

property_info = zend_get_property_info(Z_OBJCE_P(object), Z_STR(member), 1);
EG(fake_scope) = old_scope;
if (property_info != ZEND_WRONG_PROPERTY_INFO && property_info &&
zend_hash_exists(Z_OBJPROP_P(object), property_info->name)) {
zval_ptr_dtor(&member);
ZVAL_DEREF(data);
return data;
}
zval_ptr_dtor(&member);
return NULL;
}
zval_ptr_dtor(&member);
EG(fake_scope) = old_scope;
ZVAL_DEREF(data);
return data;
} else if (Z_TYPE_P(object) == IS_ARRAY) {
Expand All @@ -1210,15 +1189,7 @@ static zval* get_zval_property(zval* object, char* name, zval *rv)
static void unset_zval_property(zval* object, char* name)
{
if (Z_TYPE_P(object) == IS_OBJECT) {
zval member;
zend_class_entry *old_scope;

ZVAL_STRING(&member, name);
old_scope = EG(fake_scope);
EG(fake_scope) = Z_OBJCE_P(object);
Z_OBJ_HT_P(object)->unset_property(object, &member, NULL);
EG(fake_scope) = old_scope;
zval_ptr_dtor(&member);
zend_unset_property(Z_OBJCE_P(object), object, name, strlen(name));
} else if (Z_TYPE_P(object) == IS_ARRAY) {
zend_hash_str_del(Z_ARRVAL_P(object), name, strlen(name));
}
Expand Down

0 comments on commit 83fe1f1

Please sign in to comment.