Merge branch 'v2.6.x'
authorMichael Wallner <mike@php.net>
Wed, 7 Sep 2016 06:01:09 +0000 (08:01 +0200)
committerMichael Wallner <mike@php.net>
Wed, 7 Sep 2016 06:02:46 +0000 (08:02 +0200)
15 files changed:
package.xml
scripts/gen_travis_yml.php
src/php_http_client.c
src/php_http_client_curl_user.c
tests/bug69357.phpt
tests/bug71719.phpt
tests/client021.phpt
tests/client027.phpt
tests/client028.phpt
tests/client029.phpt
tests/client030.phpt
tests/gh-issue12.phpt
tests/gh-issue47.phpt
tests/gh-issue50.phpt
tests/gh-issue6.phpt

index e104c7ebfc599fbd073a995a959a13849331cc85..f8d65e0aaf08718262b9baf0bcdd4aea31027c5a 100644 (file)
@@ -31,7 +31,7 @@ https://mdref.m6w6.name/http
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2016-08-22</date>
+ <date>2016-09-07</date>
  <version>
   <release>3.1.0beta2</release>
   <api>3.1.0</api>
@@ -65,6 +65,9 @@ https://mdref.m6w6.name/http
 * Fix gh-issue #34: allow setting multiple headers with the same name (Mike, @rcanavan)
 * Fix gh-issue #33: allow setting prodyhost request option to NULL (Mike, @rcanavan)
 * Fix gh-issue #31: add/improve configure checks for default CA bundle/path (Mike, @rcanavan)
+
+Changes from beta1:
+* Fixed recursive calls to the event loop dispatcher
 ]]></notes>
  <contents>
   <dir name="/">
@@ -273,6 +276,7 @@ https://mdref.m6w6.name/http
      <file role="test" name="filterchunked.phpt"/>
      <file role="test" name="filterzlib.phpt"/>
      <file role="test" name="gh-issue6.phpt"/>
+     <file role="test" name="gh-issue7.phpt"/>
      <file role="test" name="gh-issue12.phpt"/>
      <file role="test" name="gh-issue42.phpt"/>
      <file role="test" name="gh-issue47.phpt"/>
index f83d0b4c3f9e62e36135e46fecd54dcaef761562..311a4cd000afa5edccef34ab7e1bdcf7349e6bdb 100755 (executable)
@@ -23,8 +23,6 @@ $env = $gen([
        "enable_json",
        "enable_hash" => ["yes"],
        "enable_iconv" => ["yes"],
-       "enable_phar" => ["yes"],
-       "enable_posix" => ["yes"]
 ]);
 foreach ($env as $e) {
        printf(" - %s\n", $e);
index d0e6e80107c28dc65de29971d3d348a2689fba86..4118ab18263fd7156a7852ba3860c610bc95dac0 100644 (file)
@@ -1270,7 +1270,8 @@ static PHP_METHOD(HttpClient, getAvailableConfiguration)
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_setDebug, 0, 0, 1)
-       ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1)
+       /* using IS_CALLABLE type hint would create a forwards compatibility break */
+       ZEND_ARG_INFO(0, callback)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(HttpClient, setDebug)
 {
index 225ce1cda8aa8828856880b7d5d23b1e0b6e3227..66edae664db2677cf0ef1490df05740415988cd1 100644 (file)
@@ -260,7 +260,8 @@ zend_class_entry *php_http_client_curl_user_get_class_entry()
 }
 
 ZEND_BEGIN_ARG_INFO_EX(ai_init, 0, 0, 1)
-       ZEND_ARG_TYPE_INFO(0, run, IS_CALLABLE, 0)
+       /* using IS_CALLABLE type hint would create a forwards compatibility break */
+       ZEND_ARG_INFO(0, run)
 ZEND_END_ARG_INFO();
 ZEND_BEGIN_ARG_INFO_EX(ai_timer, 0, 0, 1)
 #if PHP_VERSION_ID >= 70000
index ac93baf3e5192865674fe74b40ee8f5d30c3a07d..8d731c53da9cab0c8a720df032993680d70b2b4c 100644 (file)
@@ -12,11 +12,11 @@ echo "Test\n";
 include "helper/server.inc";
 
 server("upload.inc", function($port) {
-       $r = new \http\Client\Request("PUT", "http://localhost:$port/", [],
-                       (new \http\Message\Body)->append("foo")
-       );
+       $b = new \http\Message\Body;
+       $b->append("foo");
+       $r = new \http\Client\Request("PUT", "http://localhost:$port/", array(), $b);
        $c = new \http\Client;
-       $c->setOptions(["expect_100_timeout" => 0]);
+       $c->setOptions(array("expect_100_timeout" => 0));
        $c->enqueue($r)->send();
        
        var_dump($c->getResponse($r)->getInfo());
index f75bac90e85500a4db253dde25288ff33f3d096a..fb0138bbe0a4f8188c6d1dc867642fa5d0478275 100644 (file)
@@ -20,6 +20,6 @@ try {
 Test
 %r(exception ')?%rhttp\Exception\BadMessageException%r(' with message '|: )%rhttp\Message::__construct(): Could not parse HTTP protocol version 'HTTP/%s.0'%r'?%r in %sbug71719.php:5
 Stack trace:
-#0 %sbug71719.php(5): http\Message->__construct('\x80\xACTd 5 HTTP/1.1...', false)
+#0 %sbug71719.php(5): http\Message->__construct('%r(\?\?|\\x80\\xAC)%rTd 5 HTTP/1.1...', false)
 #1 {main}
 ===DONE===
index ef649093e077d243b11379f2df031d4581155478..e819003347b5df71909eae234e8e3e1f1bc84cfd 100644 (file)
@@ -110,8 +110,10 @@ dump($tmpfile);
 });
 
 
-(new http\Client("curl", "test"))->configure(["share_cookies" => false]);
-$request->setOptions(["cookiestore" => null]);
+$c = new http\Client("curl", "test");
+$c->configure(array("share_cookies" => false));
+$c = null;
+$request->setOptions(array("cookiestore" => null));
 
 server("cookie.inc", function($port) use($request, $tmpfile) {
        $request->setOptions(array("port" => $port));
index 5d81194c0aa323bdc1f746a05bf625d1594dd1bb..d33a58db02c84dbb42b4d39dc6bc77d397957f00 100644 (file)
@@ -15,7 +15,7 @@ echo "Test\n";
 
 server("cookie.inc", function($port) {
        $client = new http\Client(null, "cookies");
-       $client->configure(["pipelining" => false]);
+       $client->configure(array("pipelining" => false));
        $request = new http\Client\Request("GET", "http://localhost:$port?r1");
        $client->enqueue($request);
        $client->send();
index 27ab2b646f37703f78ba9ed375726aab7f3bf2b6..232f56285d560d6290e3321d13df34044020f715 100644 (file)
@@ -13,19 +13,19 @@ class UserHandler implements http\Client\Curl\User
 {
        private $client;
        private $run;
-       private $fds = [
-                       "R" => [],
-                       "W" => []
-       ];
-       private $R = [];
-       private $W = [];
+       private $fds = array(
+                       "R" => array(),
+                       "W" => array()
+       );
+       private $R = array();
+       private $W = array();
        private $timeout = 1000;
        
        function __construct(http\Client $client) {
                $this->client = $client;
        }
        
-       function init(callable $run) {
+       function init($run) {
                $this->run = $run;
        }
        
@@ -124,9 +124,9 @@ include "helper/server.inc";
 
 server("proxy.inc", function($port) {
        $client = new http\Client;
-       $client->configure([
+       $client->configure(array(
                        "use_eventloop" => new UserHandler($client)
-       ]);
+       ));
        $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/"), function($r) {
                var_dump($r->getResponseCode());
        });
index 70f1005e6a3114f19800484d0a409584948c2c79..1c8dc4f3528700708d342f08478461847e1fc591 100644 (file)
@@ -25,7 +25,7 @@ class UserHandler implements http\Client\Curl\User
                $this->client = $client;
        }
        
-       function init(callable $run) {
+       function init($run) {
                $this->run = $run;
        }
        
index 582087f93f3fa93aadb0c483ffd3e69a61b0f6bb..2a07128f7d921450c670e5c898cf1e756e62d7f8 100644 (file)
@@ -17,9 +17,9 @@ class test implements SplObserver {
 }
 server("proxy.inc", function($port) {
        $client = new http\Client;
-       $client->configure([
+       $client->configure(array(
                        "use_eventloop" => true,
-       ]);
+       ));
        $client->attach(new test);
        $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/"), function($r) {
                var_dump($r->getResponseCode());
index 07215863ef6768c5d2de2a1668b4f7f5355ae630..8b2e3787ef50769a9e98db89c1478e693371def3 100644 (file)
@@ -14,7 +14,8 @@ $urls = array(
 
 foreach ($urls as $url) {
        try {
-               (new http\Client\Request)->setRequestUrl($url);
+               $c = new http\Client\Request;
+               $c->setRequestUrl($url);
                printf("OK: %s\n", $url);
        } catch (Exception $e) {
                printf("%s\n", $e->getMessage());
index 1a09b8d3579dca58b2c05b4211f6c4ce48791ada..29205ecf16f0a8b763da910c8c36bf490ec50707 100644 (file)
@@ -8,10 +8,10 @@ include "skipif.inc";
 <?php
 echo "Test\n";
 
-$urls = [
+$urls = array(
     "",
     "? = ="
-];
+);
 
 $url0=new http\Url($urls[0], null, http\Url::FROM_ENV);
 $url1=$url0->mod($urls[1]);
index 6cef7d9aef525ab3476976d0333101a879fa6c75..52c764852613e5d4a94e7c8cd7fd5a9a07695fc8 100644 (file)
@@ -33,7 +33,7 @@ Test
 http\Exception\RuntimeException: http\Client::dequeue(): Could not dequeue request while executing callbacks in %sgh-issue50.php:9
 Stack trace:
 #0 %sgh-issue50.php(9): http\Client->dequeue(Object(http\Client\Request))
-#1 [internal function]: {closure}(Object(http\Client), Object(http\Client\Request), 18, 'GET / HTTP/1.1\r...')
+#1 [internal function]: {closure}(Object(http\Client), Object(http\Client\Request), 18, 'GET / HTTP/1.1%s...')
 #2 %sgh-issue50.php(14): http\Client->send()
 #3 {main}
 ===DONE===
index 3de34bd65fec8ff4964e42f073de7ad608d820a3..470bfea01180e2709d396bdd52982e06bf728a2a 100644 (file)
@@ -7,9 +7,11 @@ url - unsafe characters
 
 echo "Test\n";
 
-echo (new http\Url("?__utma=1152894289.1017686999.9107388726.1439222726.1494721726.1&__utmb=115739289.1.10.1437388726&__utmc=115883619&__utmx=-&__utmz=115111289.14310476.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)&__utmv=-&__utmk=112678937"))->query;
+$url = new http\Url("?__utma=1152894289.1017686999.9107388726.1439222726.1494721726.1&__utmb=115739289.1.10.1437388726&__utmc=115883619&__utmx=-&__utmz=115111289.14310476.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)&__utmv=-&__utmk=112678937");
+echo $url->query;
 echo "\n";
-echo (new http\Url("?id={\$id}"))->query;
+$url = new http\Url("?id={\$id}");
+echo $url->query;
 echo "\n";
 
 ?>