]> granicus.if.org Git - php/commitdiff
Use Zend API helper functions
authorDmitry Stogov <dmitry@zend.com>
Tue, 11 Sep 2018 20:50:43 +0000 (23:50 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 11 Sep 2018 20:50:43 +0000 (23:50 +0300)
ext/soap/php_encoding.c

index b3c3ea0391f60e04a5611bfd73727dfbe3e74d76..41b704897c3d67a04724aa4e25ebbe1cfd920662 100644 (file)
@@ -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) {
@@ -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));
        }