Merge branch 'master' of git.php.net:/pecl/http/pecl_http
authorRemi Collet <remi@php.net>
Wed, 18 Mar 2015 07:12:31 +0000 (08:12 +0100)
committerRemi Collet <remi@php.net>
Wed, 18 Mar 2015 07:12:31 +0000 (08:12 +0100)
* 'master' of git.php.net:/pecl/http/pecl_http:
  release 2.4.0
  it is always bad to rely on external things
  back to dev
  release 2.3.2
  fis querystring offset set bug
  fis querystring offset set bug
  this test requires online

package.xml
php_http.h
php_http_querystring.c
tests/bug66388.phpt
tests/querystring003.phpt [new file with mode: 0644]

index 40a7227..bdf3b89 100644 (file)
@@ -35,18 +35,18 @@ http://dev.iworks.at/ext-http/lcov/ext/http/
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2015-03-01</date>
+ <date>2015-03-18</date>
  <version>
-  <release>2.4.0dev</release>
+  <release>2.4.0</release>
   <api>2.4.0</api>
  </version>
  <stability>
-  <release>beta</release>
-  <api>beta</api>
+  <release>stable</release>
+  <api>stable</api>
  </stability>
  <license>BSD, revised</license>
  <notes><![CDATA[
-*
+* Split off pecl/apfd and pecl/json_post
 ]]></notes>
  <contents>
   <dir name="/">
index baacd4b..02326fb 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_PECL_HTTP_VERSION "2.4.0dev"
+#define PHP_PECL_HTTP_VERSION "2.4.0"
 
 extern zend_module_entry http_module_entry;
 #define phpext_http_ptr &http_module_entry
index 15a000b..d265748 100644 (file)
@@ -606,11 +606,19 @@ PHP_METHOD(HttpQueryString, offsetSet)
                return;
        }
 
-       MAKE_STD_ZVAL(param);
-       array_init(param);
-       Z_ADDREF_P(value);
-       add_assoc_zval_ex(param, offset_str, offset_len + 1, value);
-       php_http_querystring_set(getThis(), param, 0 TSRMLS_CC);
+       param = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+
+       if (Z_TYPE_P(param) == IS_ARRAY && zend_symtable_exists(Z_ARRVAL_P(param), offset_str, offset_len + 1)) {
+               Z_ADDREF_P(value);
+               zend_symtable_update(Z_ARRVAL_P(param), offset_str, offset_len + 1, (void *) &value, sizeof(zval *), NULL);
+               Z_ADDREF_P(param);
+       } else {
+               MAKE_STD_ZVAL(param);
+               array_init(param);
+               Z_ADDREF_P(value);
+               add_assoc_zval_ex(param, offset_str, offset_len + 1, value);
+       }
+       php_http_querystring_set(getThis(), param, QS_MERGE TSRMLS_CC);
        zval_ptr_dtor(&param);
 }
 
index 9f9c95e..e4cbf2a 100644 (file)
@@ -27,7 +27,7 @@ echo $client->send()->getResponse()->getResponseCode();
 ?>
 
 ===DONE===
---EXPECT--
+--EXPECTF--
 Test
-401
+40%d
 ===DONE===
diff --git a/tests/querystring003.phpt b/tests/querystring003.phpt
new file mode 100644 (file)
index 0000000..a504174
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+querystring offset set
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+
+echo "Test\n";
+
+$qs = new http\QueryString("foo=bar&bar=baz");
+echo $qs,"\n";
+$qs["foo"] = "baz";
+echo $qs,"\n";
+?>
+===DONE===
+--EXPECT--
+Test
+foo=bar&bar=baz
+foo=baz&bar=baz
+===DONE===