--FILE--
<?php
echo "-TEST\n";
-class r1 extends HttpRequest {
+class r extends HttpRequest {
function onProgress() {
- $GLOBALS['p']->detach($this);
+ static $i = array();
+ if (empty($i[$this->getUrl()])) {
+ $i[$this->getUrl()] = true;
+ try {
+ $GLOBALS['p']->detach($this);
+ } catch (Exception $ex) {
+ echo $ex, "\n";
+ }
+ }
}
-}
-class r2 extends HttpRequest {
function onFinish() {
$GLOBALS['p']->detach($this);
}
}
-$p = new HttpRequestPool(new r1("at.php.net"), new r2("de.php.net"));
+$p = new HttpRequestPool(new r("http://at.php.net"), new r("http://de.php.net"));
$p->send();
var_dump($p->getAttachedRequests());
echo "Done\n";
?>
--EXPECTF--
-%sTEST
+%aTEST
+exception 'HttpRequestPoolException' with message 'HttpRequest object(#%d) cannot be detached from the HttpRequestPool while executing the progress callback' in %aHttpRequestPool_006.php:%d
+Stack trace:
+#0 %aHttpRequestPool_006.php(%d): HttpRequestPool->detach(Object(r))
+#1 [internal function]: r->onProgress(Array)
+#2 %aHttpRequestPool_006.php(%d): HttpRequestPool->send()
+#3 {main}
+exception 'HttpRequestPoolException' with message 'HttpRequest object(#%d) cannot be detached from the HttpRequestPool while executing the progress callback' in %aHttpRequestPool_006.php:%d
+Stack trace:
+#0 %aHttpRequestPool_006.php(%d): HttpRequestPool->detach(Object(r))
+#1 [internal function]: r->onProgress(Array)
+#2 %aHttpRequestPool_006.php(%d): HttpRequestPool->send()
+#3 {main}
array(0) {
}
Done