- add test for crash when detaching request from pool in callbacks
authorMichael Wallner <mike@php.net>
Thu, 24 Aug 2006 08:18:19 +0000 (08:18 +0000)
committerMichael Wallner <mike@php.net>
Thu, 24 Aug 2006 08:18:19 +0000 (08:18 +0000)
package2.xml
tests/HttpRequestPool_006.phpt [new file with mode: 0644]

index 5773d4d8a3cf949a8fe8c505b6752c0b9ea3eaf4..406cadade166e74eadbfd4a4d008ee8b3950c3e3 100644 (file)
@@ -42,6 +42,7 @@ support. Parallel requests are available for PHP 5 and greater.
 * Fixed issues with inheritance and cloning of HttpDeflateStream, HttpInflateStream and HttpMessage
   (Extending classes lose default properties on instantiation; Complex members ignored during cloning)
 * Fixed suppression of nested exceptions in e.g. HttpRequestPool::send()
+* Fixed crash on detaching requests from pool in request event callbacks
 ]]></notes>
  <contents>
   <dir name="/">
@@ -197,6 +198,7 @@ support. Parallel requests are available for PHP 5 and greater.
     <file role="test" name="HttpRequestPool_003.phpt"/>
     <file role="test" name="HttpRequestPool_004.phpt"/>
     <file role="test" name="HttpRequestPool_005.phpt"/>
+    <file role="test" name="HttpRequestPool_006.phpt"/>
     <file role="test" name="HttpResponse_001.phpt"/>
     <file role="test" name="HttpResponse_002.phpt"/>
     <file role="test" name="HttpResponse_003.phpt"/>
diff --git a/tests/HttpRequestPool_006.phpt b/tests/HttpRequestPool_006.phpt
new file mode 100644 (file)
index 0000000..9d788ad
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+HttpRequestPool detaching in callbacks
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcls("HttpRequestPool");
+checkurl("at.php.net");
+checkurl("de.php.net");
+?>
+--FILE--
+<?php
+echo "-TEST\n";
+class r1 extends HttpRequest {
+       function onProgress() {
+               $GLOBALS['p']->detach($this);
+       }
+}
+class r2 extends HttpRequest {
+       function onFinish() {
+               $GLOBALS['p']->detach($this);
+       }
+}
+$p = new HttpRequestPool(new r1("at.php.net"), new r2("de.php.net"));
+$p->send();
+var_dump($p->getAttachedRequests());
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+array(0) {
+}
+Done