Bug #73506 [Opn->Wfx]: php_url_parse_ex does not support resource id in url scheme

From: Date: Sun, 13 Nov 2016 16:07:18 +0000
Subject: Bug #73506 [Opn->Wfx]: php_url_parse_ex does not support resource id in url scheme
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205336@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73506&edit=1 ID: 73506 Updated by: ab@php.net Reported by: firestorm9 at gmail dot com Summary: php_url_parse_ex does not support resource id in url scheme -Status: Open +Status: Wont fix Type: Bug Package: Streams related Operating System: Linux PHP Version: 5.6.28 Block user comment: N Private report: N New Comment: See bug #73192. AFAIR, the fix for ext/ssh2 is on the way. Thanks. Previous Comments: ------------------------------------------------------------------------ [2016-11-12 15:48:56] firestorm9 at gmail dot com 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); ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73506&edit=1

« previous php.bugs (#205336) next »