Skip to content

Commit fb21361

Browse files
committed
Curlinfo fix
1 parent 14ead64 commit fb21361

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Curl.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ public function exec($attempts = 1, $useException = false)
133133
*/
134134
public function getInfo($opt = 0)
135135
{
136-
return curl_getinfo($this->handle, $opt);
136+
if (func_num_args() > 0) {
137+
return curl_getinfo($this->handle, $opt);
138+
}
139+
return curl_getinfo($this->handle);
137140
}
138141

139142
/**

test/CurlTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function curl_unescape($v, $s)
5353
return 'unescape_'.$v.'_'.$s;
5454
}
5555

56-
function curl_getinfo($h, $o)
56+
function curl_getinfo($h, $o = null)
5757
{
58-
return 'getinfo_'.$h.'_'.$o;
58+
return 'getinfo_'.$h.'_'.func_num_args().'_'.$o;
5959
}
6060

6161
function curl_pause($h, $m)
@@ -108,8 +108,8 @@ public function testAll()
108108
$c->reset();
109109
$this->assertEquals('reset_foo', array_pop(self::$log));
110110

111-
$this->assertEquals('getinfo_foo_0', $c->getinfo());
112-
$this->assertEquals('getinfo_foo_42', $c->getinfo(42));
111+
$this->assertEquals('getinfo_foo_1_', $c->getinfo());
112+
$this->assertEquals('getinfo_foo_2_42', $c->getinfo(42));
113113

114114
$this->assertEquals('pause_foo_42', $c->pause(42));
115115

0 commit comments

Comments
 (0)