fix httpVersion retrieval on bigendian
authorRemi Collet <remi@php.net>
Wed, 3 Sep 2014 13:31:33 +0000 (15:31 +0200)
committerMichael Wallner <mike@php.net>
Tue, 9 Sep 2014 07:53:42 +0000 (09:53 +0200)
Conflicts:
php_http_message.c

php_http_message.c

index 88def26b8eccccc27bb914fa211059555a144464..f7696da5f520915f135ce051b368068c2b41b101 100644 (file)
@@ -941,6 +941,7 @@ static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC)
        HashTable *props = zend_get_std_object_handlers()->get_properties(object TSRMLS_CC);
        zval array, *parent, *body;
        char *version;
+       int verlen;
 
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
        
@@ -964,8 +965,9 @@ static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC)
                } \
        } while(0)
 
-       ASSOC_PROP(long, "type", msg->type);
-       ASSOC_STRINGL_EX("httpVersion", version, spprintf(&version, 0, "%u.%u", msg->http.version.major, msg->http.version.minor), 0);
+       ASSOC_PROP(long, "type", obj->message->type);
+       verlen = spprintf(&version, 0, "%u.%u", obj->message->http.version.major, obj->message->http.version.minor);
+       ASSOC_STRINGL_EX("httpVersion", version, verlen, 0);
 
        switch (msg->type) {
                case PHP_HTTP_REQUEST: