php / pecl-networking-ssh2

Bindings for the libssh2 library
http://pecl.php.net/package/ssh2
Other
51 stars 58 forks source link

ssh2_auth_pubkey_file caused "segmentation fault" when enable xdebug #59

Closed xiaoxiaoyu93 closed 1 year ago

xiaoxiaoyu93 commented 2 years ago
#...

dump(php_uname('a'));
dump(phpversion('ssh2'));
dump(phpversion('xdebug'));

dump(php_uname('a'));
dump(phpversion());
dump(phpversion('ssh2'));
dump(phpversion('xdebug'));

$ssh_conn = ssh2_connect($my_hostname, 22222, ['hostkey' => 'ssh-rsa']);
dump($ssh_conn);
$auth_result =  ssh2_auth_pubkey_file($ssh_conn, $my_username,
    '~/.ssh/id_rsa.pub',
    '~/.ssh/id_rsa');
dump($auth_result);

"Darwin myhostname.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64"
"8.1.6"
"1.3.1"
false
SSH2 Session resource @556
true


"Darwin myhostname.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 x86_64"
"8.1.6"
"1.3.1"
"3.1.4"
SSH2 Session resource @556
[1]    17604 segmentation fault  myscript.php
------
langemeijer commented 1 year ago

I do not know what dump() does, nor can I see from your example when the segmentation fault actually occurs. Also I could not reproduce the error with newer PHP 8.1.17 and xdebug 3.2.0. I'm assuming the segfault was caused by either php or xdebug here.