Merge branch 'v2.6.x'
authorMichael Wallner <mike@php.net>
Tue, 23 Aug 2016 09:51:01 +0000 (11:51 +0200)
committerMichael Wallner <mike@php.net>
Tue, 23 Aug 2016 09:52:38 +0000 (11:52 +0200)
package.xml
php_http.h
src/php_http_client_curl.c
tests/client030.phpt [new file with mode: 0644]

index 60a8e35981d5011eedd40f7ef87eb8a1a9953560..e104c7ebfc599fbd073a995a959a13849331cc85 100644 (file)
@@ -33,7 +33,7 @@ https://mdref.m6w6.name/http
  </lead>
  <date>2016-08-22</date>
  <version>
-  <release>3.1.0beta1</release>
+  <release>3.1.0beta2</release>
   <api>3.1.0</api>
  </version>
  <stability>
index 6a9f01bf7176e0c230b67d294452447a079c89b9..21510238f637271736f8e1e80ee44d04576928a8 100644 (file)
@@ -13,7 +13,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_PECL_HTTP_VERSION "3.1.0beta1"
+#define PHP_PECL_HTTP_VERSION "3.1.0beta2"
 
 extern zend_module_entry http_module_entry;
 #define phpext_http_ptr &http_module_entry
index 1e92fbe1c1e2bb26053f9b81e5e43b995c3cd8b5..9d41e2979f4b61c1e69852b5fecb6a7aa46848ae 100644 (file)
@@ -2260,16 +2260,17 @@ static int php_http_client_curl_once(php_http_client_t *h)
 {
        php_http_client_curl_t *curl = h->ctx;
 
-       if (curl->ev_ops) {
-               curl->ev_ops->once(curl->ev_ctx);
-       } else {
-               while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curl->handle->multi, &curl->unfinished));
-       }
+       if (!h->callback.depth) {
+               if (curl->ev_ops) {
+                       curl->ev_ops->once(curl->ev_ctx);
+               } else {
+                       while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curl->handle->multi, &curl->unfinished));
+               }
 
-       php_http_client_curl_responsehandler(h);
+               php_http_client_curl_responsehandler(h);
+       }
 
        return curl->unfinished;
-
 }
 
 static ZEND_RESULT_CODE php_http_client_curl_exec(php_http_client_t *h)
diff --git a/tests/client030.phpt b/tests/client030.phpt
new file mode 100644 (file)
index 0000000..582087f
--- /dev/null
@@ -0,0 +1,35 @@
+--TEST--
+client eventloop recursion
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+include "helper/server.inc";
+
+class test implements SplObserver {
+       function update(SplSubject $client) {
+               $client->once();
+       }
+}
+server("proxy.inc", function($port) {
+       $client = new http\Client;
+       $client->configure([
+                       "use_eventloop" => true,
+       ]);
+       $client->attach(new test);
+       $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/"), function($r) {
+               var_dump($r->getResponseCode());
+       });
+       $client->send();
+});
+
+?>
+===DONE===
+--EXPECTF--
+Test
+int(200)
+===DONE===
\ No newline at end of file