Skip to content

Commit 94b4abd

Browse files
solotandemkrakjoe
authored andcommitted
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.
1 parent 51172e8 commit 94b4abd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ext/phar/tests/phar_oo_002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int(0)
7171
string(3) "dir"
7272
bool(false)
7373
bool(true)
74-
bool(false)
74+
bool(true)
7575
bool(false)
7676
bool(true)
7777
bool(false)

ext/standard/filestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ PHPAPI void php_stat(const char *filename, size_t filename_length, int type, zva
905905
case FS_IS_R:
906906
RETURN_BOOL((ssb.sb.st_mode&rmask)!=0);
907907
case FS_IS_X:
908-
RETURN_BOOL((ssb.sb.st_mode&xmask)!=0 && !S_ISDIR(ssb.sb.st_mode));
908+
RETURN_BOOL((ssb.sb.st_mode&xmask)!=0);
909909
case FS_IS_FILE:
910910
RETURN_BOOL(S_ISREG(ssb.sb.st_mode));
911911
case FS_IS_DIR:

0 commit comments

Comments
 (0)