com php-src: Merge branch 'PHP-7.1' into PHP-7.2: NEWS ext/ftp/tests/server.inc ext/standard/ftp_fopen_wrapper.c

From: Date: Tue, 04 Sep 2018 02:55:15 +0000
Subject: com php-src: Merge branch 'PHP-7.1' into PHP-7.2: NEWS ext/ftp/tests/server.inc ext/standard/ftp_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102976@lists.php.net to get a copy of this message
Commit: fcf78dfb8957f65351222752f2dcd85935ee2192 Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 4 Sep 2018 04:55:15 +0200 Parents: a6b8651d94839986be4c3ced42f178524c7de5e2 742783c3ee4df424b5bd9130028951259ca52860 Branches: PHP-7.2 PHP-7.3 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fcf78dfb8957f65351222752f2dcd85935ee2192 Log: Merge branch 'PHP-7.1' into PHP-7.2 Changed paths: MM NEWS MM ext/ftp/tests/server.inc MM ext/standard/ftp_fopen_wrapper.c Diff: diff --cc NEWS index 55444bf,aaaf511..307a192 --- a/NEWS +++ b/NEWS @@@ -1,11 -1,15 +1,15 @@@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| -?? ??? 2018, PHP 7.1.23 +?? ??? 2018, PHP 7.2.11 - POSIX: - Fixed bug #75696 (posix_getgrnam fails to print details of group). (cmb) + . Fixed bug #75696 (posix_getgrnam fails to print details of group). (cmb) + + - Standard: + . Fixed bug #73457 (Wrong error message when fopen FTP wrapped fails to open + data connection). (Ville Hukkamäki) -13 Sep 2018, PHP 7.1.22 +13 Sep 2018, PHP 7.2.10 - Core: . Fixed bug #76754 (parent private constant in extends class memory leak). diff --cc ext/ftp/tests/server.inc index a1bf074,2d4055f..67531de --- a/ext/ftp/tests/server.inc +++ b/ext/ftp/tests/server.inc @@@ -476,49 -465,9 +486,51 @@@ if ($pid) fputs($s, "350 OK\r\n"); }elseif (preg_match('/^SIZE largefile/', $buf)) { fputs($s, "213 5368709120\r\n"); - }elseif (preg_match('/^SIZE \/bug73457/', $buf)) { - fputs($s, "213 10\r\n"); - }else { + }elseif (preg_match('/^MLSD no_exists\//', $buf, $matches)) { + fputs($s, "425 Error establishing connection\r\n"); + }elseif (preg_match("~^MLSD(?: ([A-Za-z./]+))?\r\n$~", $buf, $m)) { + + if(isset($m[1]) && (($m[1] === 'bogusdir') || ($m[1] === '/bogusdir'))) { + fputs($s, "250 $m[1]: No such file or directory\r\n"); + continue; + } + + // there are some servers that don't open the ftp-data socket if there's nothing to send + if(isset($bug39458) && isset($m[1]) && $m[1] === 'emptydir') { + fputs($s, "226 Transfer complete.\r\n"); + continue; + } + + if(empty($pasv)) { + fputs($s, "150 File status okay; about to open data connection\r\n"); + if(!$fs = stream_socket_client("tcp://$host:$port")) { + fputs($s, "425 Can't open data connection\r\n"); + continue; + } + } else { + fputs($s, "125 Data connection already open; transfer starting.\r\n"); + $fs = $pasvs; + } + + if((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, TRUE, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) { + die("SSLv23 handshake failed.\n"); + } + + if(empty($m[1]) || $m[1] !== 'emptydir') { + fputs($fs, "modify=20170127230002;perm=flcdmpe;type=cdir;unique=811U4340002;UNIX.group=33;UNIX.mode=0755;UNIX.owner=33; .\r\n"); + fputs($fs, "modify=20170127230002;perm=flcdmpe;type=pdir;unique=811U4340002;UNIX.group=33;UNIX..mode=0755;UNIX.owner=33; ..\r\n"); + fputs($fs, "modify=20170126121225;perm=adfrw;size=4729;type=file;unique=811U4340CB9;UNIX.group=33;UNIX.mode=0644;UNIX.owner=33; foobar\r\n"); + fputs($fs, "fact=val=ue;empty=; path;name\r\n"); + fputs($fs, "no_space\r\n"); + fputs($fs, "no_semi pathname\r\n"); + fputs($fs, "no_eq; pathname\r\n"); + } + + fputs($s, "226 Closing data Connection.\r\n"); + fclose($fs); - }else { ++ }elseif (preg_match('/^SIZE \/bug73457/', $buf)) { ++ fputs($s, "213 10\r\n"); ++ }else { fputs($s, "500 Syntax error, command unrecognized.\r\n"); dump_and_exit($buf); }

« previous php.cvs (#102976) next »