Permalink
Browse files

Removing store response call from callback function.

Closes gh-88
  • Loading branch information...
1 parent 38aa1cf commit b46869427c2147df5c59eaa8e819e62bf9d902b5 @jmathai committed Sep 20, 2010
Showing with 10 additions and 11 deletions.
  1. +8 −9 EpiCurl.php
  2. +2 −2 tests/EpiTwitterTest.php
View
@@ -128,7 +128,6 @@ private function headerCallback($ch, $header)
$val = preg_replace('/^\W+/','',substr($_header, $colonPos));
$this->responses[$this->getKey($ch)]['headers'][$key] = $val;
}
- $this->storeResponse($ch);
return strlen($header);
}
@@ -140,22 +139,22 @@ private function storeResponses()
}
}
- private function storeResponse($ch, $isAsynchronous = true)
+ private function storeResponse($done, $isAsynchronous = true)
{
- $key = $this->getKey($ch['handle']);
- $this->stopTimer($key, $ch);
+ $key = $this->getKey($done['handle']);
+ $this->stopTimer($key, $done);
if($isAsynchronous)
- $this->responses[$key]['data'] = curl_multi_getcontent($ch['handle']);
+ $this->responses[$key]['data'] = curl_multi_getcontent($done['handle']);
else
- $this->responses[$key]['data'] = curl_exec($ch['handle']);
+ $this->responses[$key]['data'] = curl_exec($done['handle']);
foreach($this->properties as $name => $const)
{
- $this->responses[$key][$name] = curl_getinfo($ch['handle'], $const);
+ $this->responses[$key][$name] = curl_getinfo($done['handle'], $const);
}
if($isAsynchronous)
- curl_multi_remove_handle($this->mc, $ch['handle']);
- curl_close($ch['handle']);
+ curl_multi_remove_handle($this->mc, $done['handle']);
+ curl_close($done['handle']);
}
private function startTimer($key)
@@ -157,11 +157,11 @@ function testRetweet()
function testPostStatusUnicode()
{
- $statusText = rand(0,1000) . ' Testing a random status with unicode בוקר טוב (' . time() . ')';
+ $statusText = rand(0,1000) . ' Testing a random status with unicode בוקר טוב áéíóúção (' . time() . ')';
$resp = $this->twitterObj->post('/statuses/update.json', array('status' => $statusText));
$this->assertEquals($resp->text, $statusText, 'The status was not updated correctly');
// __call
- $statusText = rand(0,1000) . ' Testing a random status with unicode בוקר טוב (' . time() . ')';
+ $statusText = rand(0,1000) . ' Testing a random status with unicode בוקר טוב áéíóúção (' . time() . ')';
$resp = $this->twitterObj->post_statusesUpdate(array('status' => $statusText));
$this->assertEquals($resp->text, $statusText, 'The status was not updated correctly');
}

0 comments on commit b468694

Please sign in to comment.