Files
archived-pecl-networking-ssh2/tests/ssh2_shell.phpt
Mitch Hagstrand 62d00b340f BUG_73819: call ssh2_shell() causes segment fault
1. php_ssh2_shell_open() was calling zend_hash_get_current_key_ex
2. php_ssh2_exec_command() / php_ssh2_shell_open() / php_ssh2_direct_tcpip()
   were being passed a pointer instead of the resource ID.
3. Renamed session_rsrc to session_rsrcid
3. Added test for ssh2_shell and reading / writing to the stream
2017-02-06 20:29:23 +01:00

24 lines
459 B
PHP

--TEST--
ssh2_shell_test() - Tests opening a shell
--SKIPIF--
<?php require('ssh2_skip.inc'); ssh2t_needs_auth(); ?>
--FILE--
<?php require('ssh2_test.inc');
$ssh = ssh2_connect(TEST_SSH2_HOSTNAME, TEST_SSH2_PORT);
var_dump(ssh2t_auth($ssh));
$shell = ssh2_shell($ssh);
var_dump($shell);
fwrite( $shell, 'echo "foo bar"'.PHP_EOL);
sleep(1);
while($line = fgets($shell)) {
echo $line;
}
--EXPECTF--
bool(true)
resource(%d) of type (stream)
%a
foo bar
%a