fix httpVersion retrieval on bigendian
authorRemi Collet <remi@php.net>
Wed, 3 Sep 2014 13:31:33 +0000 (15:31 +0200)
committerRemi Collet <remi@php.net>
Wed, 3 Sep 2014 13:31:33 +0000 (15:31 +0200)
php_http_message.c

index 70dcae82c933e68c9927b1dd5ed404a61b086e07..3141065f8353466ff9edb9003a0400397daa2ed3 100644 (file)
@@ -940,6 +940,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);
        INIT_PZVAL_ARRAY(&array, props);
@@ -963,7 +964,8 @@ static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC)
        } while(0)
 
        ASSOC_PROP(long, "type", obj->message->type);
-       ASSOC_STRINGL_EX("httpVersion", version, spprintf(&version, 0, "%u.%u", obj->message->http.version.major, obj->message->http.version.minor), 0);
+       verlen = spprintf(&version, 0, "%u.%u", obj->message->http.version.major, obj->message->http.version.minor);
+       ASSOC_STRINGL_EX("httpVersion", version, verlen, 0);
 
        switch (obj->message->type) {
                case PHP_HTTP_REQUEST: