|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-11-17 17:15 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2016-11-17 17:15 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 15:00:01 2025 UTC |
Description: ------------ After upgrading to PHP 5.6.28 it is not possible to create directories with the mkdir("ssh2.sftp://Resource id #5/somepath") notation: the mkdir() call returns bool(false) and the directory is not created on the remote host. After instrumenting `ssh2_fopen_wrappers.c` and `ext/standard/url.c` I found that the problem is that the call to php_url_parse("ssh2.sftp://Resource id #5/somepath") is returning a resource->path set to NULL. Reverting the change introduced by #73192 (https://bugs.php.net/bug.php?id=73192), a call to mkdir("ssh2.sftp://Resource id #5/somepath") correctly creates the remote dir and returns bool(true). The ssh2 extension relies on the '#' character in the hostname part of the URL to detect the underlying resource. Test script: --------------- $username = "sftp"; $hostname = "test.example.net"; $port = 22; $pk = "/path/to/id_rsa.pub"; $sk = "/path/to/id_rsa"; $passphrase = ""; $dir = "/home/sftp/xxx"; $conn_ssh = ssh2_connect($hostname, $port); ssh2_auth_pubkey_file($conn_ssh, $username, $pk, $sk, $passphrase); $conn_sftp = ssh2_sftp($conn_ssh) $uri = sprintf("ssh2.sftp://%s/%s", $conn_sftp, $dir); if (mkdir($uri) === false) { printf("Error creating directory '%s'\n", $uri); exit(1); } printf("OK\n"); exit(0); Expected result: ---------------- OK Actual result: -------------- Error creating directory 'ssh2.sftp://Resource id #5//home/sftp/xxx'