- read() doesn't give an E_WARNING when $expect is blank

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@198 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2012-03-05 03:13:09 +00:00
parent 329d3e2a15
commit 6309f5a70a

View File

@ -1810,7 +1810,7 @@ class Net_SSH2 {
* @return String * @return String
* @access public * @access public
*/ */
function read($expect, $mode = NET_SSH2_READ_SIMPLE) function read($expect = '', $mode = NET_SSH2_READ_SIMPLE)
{ {
$this->curTimeout = $this->timeout; $this->curTimeout = $this->timeout;
@ -1830,7 +1830,7 @@ class Net_SSH2 {
preg_match($expect, $this->interactiveBuffer, $matches); preg_match($expect, $this->interactiveBuffer, $matches);
$match = $matches[0]; $match = $matches[0];
} }
$pos = strpos($this->interactiveBuffer, $match); $pos = !empty($match) ? strpos($this->interactiveBuffer, $match) : false;
if ($pos !== false) { if ($pos !== false) {
return $this->_string_shift($this->interactiveBuffer, $pos + strlen($match)); return $this->_string_shift($this->interactiveBuffer, $pos + strlen($match));
} }