com php-src: Fixed bug #77765: NEWS ext/standard/ftp_fopen_ wrapper.c ext/standard/tests/streams/bug77765.p hpt
| From: | Nikita Popov | Date: | Tue, 19 Mar 2019 09:02:38 +0000 |
| Subject: | com php-src: Fixed bug #77765: NEWS ext/standard/ftp_fopen_ wrapper.c ext/standard/tests/streams/bug77765.p hpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105235@lists.php.net to get a copy of this message | ||
Commit: fe2885d80a76db84fd3a8e1556aff2221be195e1
Author: Vlad Temian <vladtemian@gmail.com> Mon, 18 Mar 2019 18:35:24 +0200
Committer: Nikita Popov <nikita.ppv@gmail.com> Tue, 19 Mar 2019 10:02:38 +0100
Parents: 09e522322af7268f53d340cbff3d109fab058539
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fe2885d80a76db84fd3a8e1556aff2221be195e1
Log:
Fixed bug #77765
Set mode 40755 for directories, via FTP stream stat.
Because we already manage to CWD into the current directory,
we should set 40755 as mode, instead of 40644.
Bugs:
https://bugs.php.net/77765
Changed paths:
M NEWS
M ext/standard/ftp_fopen_wrapper..c
A ext/standard/tests/streams/bug77765.phpt
Diff:
diff --git a/NEWS b/NEWS
index 419916f..bfe1eb5 100644
--- a/NEWS
+++ b/NEWS
@@ -58,6 +58,8 @@ PHP NEWS
(Nikita)
. Fixed bug #76717 (var_export() does not create a parsable value for
PHP_INT_MIN). (Nikita)
+ . Fixed bug #77765 (FTP stream wrapper should set the directory as
+ executable). (Vlad Temian)
07 Mar 2019, PHP 7.2.16
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index b6814e7..37b754a 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -805,7 +805,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
if (result < 200 || result > 299) {
ssb->sb.st_mode |= S_IFREG;
} else {
- ssb->sb.st_mode |= S_IFDIR;
+ ssb->sb.st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
}
php_stream_write_string(stream, "TYPE I\r\n"); /* we need this since some servers refuse
to accept SIZE command in ASCII mode */
diff --git a/ext/standard/tests/streams/bug77765.phpt b/ext/standard/tests/streams/bug77765.phpt
new file mode 100644
index 0000000..fa933ff
--- /dev/null
+++ b/ext/standard/tests/streams/bug77765.phpt
@@ -0,0 +1,22 @@
+--TEST--
+stat() on directory should return 40755 for ftp://
+--SKIPIF--
+<?php
+if (array_search('ftp',stream_get_wrappers()) === FALSE) die("skip ftp wrapper not
available.");
+if (!function_exists('pcntl_fork')) die("skip pcntl_fork() not available.");
+?>
+--FILE--
+<?php
+
+require __DIR__ . "/.../../../ftp/tests/server.inc";
+
+$path = "ftp://localhost:" .
$port.."/www";
+
+var_dump(stat($path)['mode']);
+?>
+==DONE==
+--EXPECTF--
+string(11) "SIZE /www
+"
+int(16877)
+==DONE==