add http\Url::mod(mixed $new_url[, int flags])
[m6w6/ext-http] / php_http_message.c
index a99a0bb2ecf42ca70e7ab45c4f6379e480b5d62d..ead53476ebed117277e8fc0a842ddb2a10e8b91d 100644 (file)
     +--------------------------------------------------------------------+
 */
 
-#include "php_http.h"
-
-#include <main/SAPI.h>
-#include <ext/spl/spl_iterators.h>
-#include <Zend/zend_interfaces.h>
+#include "php_http_api.h"
 
 PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC)
 {
@@ -1143,7 +1139,7 @@ static zval **php_http_message_object_get_prop_ptr(zval *object, zval *member, c
 
        if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
                zval_ptr_dtor(&copy);
-               return &php_http_property_proxy_init(NULL, object, member TSRMLS_CC)->myself;
+               return &php_http_property_proxy_init(NULL, object, member, NULL TSRMLS_CC)->myself;
        }
        zval_ptr_dtor(&copy);
 
@@ -1157,18 +1153,16 @@ static zval *php_http_message_object_read_prop(zval *object, zval *member, int t
        zval *return_value, *copy = php_http_ztyp(IS_STRING, member);
 
        if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
-               if (type == BP_VAR_W) {
-                       zval_ptr_dtor(&copy);
+               if (type == BP_VAR_R) {
+                       ALLOC_ZVAL(return_value);
+                       Z_SET_REFCOUNT_P(return_value, 0);
+                       Z_UNSET_ISREF_P(return_value);
+
+                       handler->read(obj, return_value TSRMLS_CC);
+               } else {
                        zend_error(E_ERROR, "Cannot access HttpMessage properties by reference or array key/index");
-                       return NULL;
+                       return_value = NULL;
                }
-
-               ALLOC_ZVAL(return_value);
-               Z_SET_REFCOUNT_P(return_value, 0);
-               Z_UNSET_ISREF_P(return_value);
-
-               handler->read(obj, return_value TSRMLS_CC);
-
        } else {
                return_value = zend_get_std_object_handlers()->read_property(object, member, type, literal_key TSRMLS_CC);
        }