drop dep on ext-propro (dysfunctional with PHP 8)
[m6w6/ext-http] / src / php_http_message.c
index f5e99a469029c01efff643952f851d33c4464e3a..2cce701879e2e86626c2703cdcbb4b3de91dae86 100644 (file)
@@ -895,6 +895,13 @@ void php_http_message_object_free(zend_object *object)
        zend_object_std_dtor(object);
 }
 
+#if PHP_VERSION_ID >= 70400
+static zval *php_http_message_object_get_prop_ptr(zval *object, zval *member, int type, void **cache_slot)
+{
+       return NULL;
+}
+#endif
+
 static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp)
 {
        zval *return_value;
@@ -904,20 +911,9 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t
        return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp);
 
        if (handler && handler->read) {
-               if (type == BP_VAR_R || type == BP_VAR_IS) {
-                       php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
+               php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object);
 
-                       handler->read(obj, return_value);
-               } else {
-                       php_property_proxy_t *proxy;
-                       php_property_proxy_object_t *proxy_obj;
-
-                       proxy = php_property_proxy_init(object, member_name);
-                       proxy_obj = php_property_proxy_object_new_ex(NULL, proxy);
-
-                       ZVAL_OBJ(tmp, &proxy_obj->zo);
-                       return_value = tmp;
-               }
+               handler->read(obj, return_value);
        }
 
        zend_string_release(member_name);
@@ -1470,7 +1466,7 @@ static PHP_METHOD(HttpMessage, getResponseCode)
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
 
                if (obj->message->type != PHP_HTTP_RESPONSE) {
-                       php_error_docref(NULL, E_WARNING, "http\\Message is not if type response");
+                       php_error_docref(NULL, E_WARNING, "http\\Message is not of type response");
                        RETURN_FALSE;
                }
 
@@ -2064,7 +2060,11 @@ PHP_MINIT_FUNCTION(http_message)
        php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
        php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
        php_http_message_object_handlers.get_debug_info = php_http_message_object_get_debug_info;
+#if PHP_VERSION_ID >= 70400
+       php_http_message_object_handlers.get_property_ptr_ptr = php_http_message_object_get_prop_ptr;
+#else
        php_http_message_object_handlers.get_property_ptr_ptr = NULL;
+#endif
        php_http_message_object_handlers.get_gc = php_http_message_object_get_gc;
 
        zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);