Bug #73556 [Opn->Dup]: Regression in mkdir() with ssh2 extension wrapper URL (ssh2.sftp://...)

From: Date: Thu, 17 Nov 2016 17:15:53 +0000
Subject: Bug #73556 [Opn->Dup]: Regression in mkdir() with ssh2 extension wrapper URL (ssh2.sftp://...)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205437@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73556&edit=1 ID: 73556 Updated by: requinix@php.net Reported by: jerome dot auge at anakeen dot com Summary: Regression in mkdir() with ssh2 extension wrapper URL (ssh2.sftp://...) -Status: Open +Status: Duplicate Type: Bug Package: URL related Operating System: Linux PHP Version: 5.6.28 Block user comment: N Private report: N New Comment: Duplicate of bug #73506 Previous Comments: ------------------------------------------------------------------------ [2016-11-17 17:00:00] jerome dot auge at anakeen dot com 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' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73556&edit=1

« previous php.bugs (#205437) next »