diff options
-rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 2 | ||||
-rw-r--r-- | ext/standard/tests/streams/bug77765.phpt | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 26e55cba01..4fdd91d98f 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -804,7 +804,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 0000000000..fa933ffc0d --- /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== |