diff options
author | solotandem <jim@boombatower.com> | 2018-02-26 10:24:25 -0600 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2018-03-27 21:49:26 +0200 |
commit | 94b4abdbc4dd1134f345eda0429ce19d999d8fac (patch) | |
tree | a4b0d32725cb0ee95b01144074b2daf4e053b374 | |
parent | 51172e81aa31b4b58b74f24d73e06ca4eaa8ad83 (diff) | |
download | php-git-94b4abdbc4dd1134f345eda0429ce19d999d8fac.tar.gz |
Be consistent in is_executable on a directory in any stream wrapper.
Current code treats the 'local files' stream wrapper ('php_plain_files_wrapper')
different than all other stream wrappers. For the 'local' stream wrapper,
is_executable only checks the mode key in the filestat array on the file or
directory in question. For other stream wrappers, is_executable always returns
FALSE on a directory. This treatment is inconsistent on its face.
Also, for a custom stream wrapper that also points to local files, the result
of is_executable is always FALSE even though it may be TRUE if the function were
called on the same item using the 'local' stream wrapper from PHP.
NOTE: patch does not attempt to add a test for this as there are no tests of
is_executable for stream wrappers.
-rw-r--r-- | ext/phar/tests/phar_oo_002.phpt | 2 | ||||
-rw-r--r-- | ext/standard/filestat.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/ext/phar/tests/phar_oo_002.phpt b/ext/phar/tests/phar_oo_002.phpt index f62c9a509a..2787ac8a53 100644 --- a/ext/phar/tests/phar_oo_002.phpt +++ b/ext/phar/tests/phar_oo_002.phpt @@ -71,7 +71,7 @@ int(0) string(3) "dir" bool(false) bool(true) -bool(false) +bool(true) bool(false) bool(true) bool(false) diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index e2b3245e97..a15f3287c2 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -905,7 +905,7 @@ PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zva case FS_IS_R: RETURN_BOOL((ssb.sb.st_mode&rmask)!=0); case FS_IS_X: - RETURN_BOOL((ssb.sb.st_mode&xmask)!=0 && !S_ISDIR(ssb.sb.st_mode)); + RETURN_BOOL((ssb.sb.st_mode&xmask)!=0); case FS_IS_FILE: RETURN_BOOL(S_ISREG(ssb.sb.st_mode)); case FS_IS_DIR: |