|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-11-13 16:07 UTC] ab@php.net
-Status: Open
+Status: Wont fix
[2016-11-13 16:07 UTC] ab@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 17:00:02 2025 UTC |
Description: ------------ The code in php_url_parse_ex was changed in a way that does no longer support "Resource id #8" in a url scheme. Reverting the code in ext/standard/url.c at line 220 fixes the issue: // e = s + strcspn(s, "/?#"); if (!(p = memchr(s, '/', (ue - s)))) { char *query, *fragment; query = memchr(s, '?', (ue - s)); fragment = memchr(s, '#', (ue - s)); if (query && fragment) { if (query > fragment) { e = fragment; } else { e = query; } } else if (query) { e = query; } else if (fragment) { e = fragment; } } else { e = p; } Test script: --------------- <?php error_reporting(-1); $host = 'any.sftp.host'; $port = 22; $path = '/a/valid/path'; $username = 'user'; $password = 'pass'; $filename = 'zzz-test.txt'; $textOutput = "This is a test\n\ntest\ntest\ntest\ntest\ntest\n"; try { $sshConnection = ssh2_connect($host, $port); if (! $sshConnection) { die("Failed to open connection to $host.\n"); } echo "Connection established\n"; ssh2_auth_password($sshConnection, $username, $password); $sftp = ssh2_sftp($sshConnection); $sftpStream = @fopen("ssh2.sftp://$sftp" . $path . $filename, 'w'); } catch(Exception $e) { die("Failed to open SFTP connection to $host: " . $e->getMessage() . "\n"); } if (!$sftpStream) { die("Failed to open stream to $host\n"); } echo "Stream opened"; try { $writeResult = @fwrite($sftpStream, $orderOutput); } catch(Exception $e) { die("Failed to write $path/$filename to $host: " . $e->getMessage() . "\n"); } if ($writeResult === false) { die("Failed to write $path/$filename to $host\n"); } echo "Stream wrote successfully\n"; fclose($sftpStream); ?>