mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-17 10:45:11 +00:00
Merge branch 'master' into php5
* master: Tests for bug280. Also replace this with call_user_func Use call_user_func, as this will work on PHP < 5.4, whereas $callback() does not
This commit is contained in:
commit
cb56e676dc
@ -216,7 +216,7 @@ class Net_SCP
|
|||||||
$sent+= strlen($temp);
|
$sent+= strlen($temp);
|
||||||
|
|
||||||
if (is_callable($callback)) {
|
if (is_callable($callback)) {
|
||||||
$callback($sent);
|
call_user_func($callback, $sent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_close();
|
$this->_close();
|
||||||
|
@ -2258,7 +2258,7 @@ class Net_SSH2
|
|||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
if (is_callable($callback)) {
|
if (is_callable($callback)) {
|
||||||
$callback($temp);
|
call_user_func($callback, $temp);
|
||||||
} else {
|
} else {
|
||||||
$output.= $temp;
|
$output.= $temp;
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,21 @@ class Net_SSH2FunctionalTest extends PhpseclibFunctionalTestCase
|
|||||||
$ssh->login($username, $password),
|
$ssh->login($username, $password),
|
||||||
'SSH2 login using password failed.'
|
'SSH2 login using password failed.'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return $ssh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @depends testPasswordLogin
|
||||||
|
* @group bug280
|
||||||
|
*/
|
||||||
|
public function testExecWithMethodCallback($ssh)
|
||||||
|
{
|
||||||
|
$callbackObject = $this->getMock('stdClass', array('callbackMethod'));
|
||||||
|
$callbackObject
|
||||||
|
->expects($this->atLeastOnce())
|
||||||
|
->method('callbackMethod')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
$ssh->exec('ls', array($callbackObject, 'callbackMethod'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user