Skip to content

Commit 4686539

Browse files
committed
Attempt to fix ext/spl/tests/bug67359.phpt broken by f323baa
1 parent 92665cd commit 4686539

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ext/spl/spl_directory.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,14 +1478,17 @@ PHP_METHOD(RecursiveDirectoryIterator, hasChildren)
14781478
RETURN_THROWS();
14791479
}
14801480
php_stat(intern->file_name, FS_LPERMS, return_value);
1481-
if (S_ISLNK(Z_LVAL_P(return_value))) {
1481+
if (Z_TYPE_P(return_value) == IS_FALSE) {
1482+
return;
1483+
} else if (!S_ISLNK(Z_LVAL_P(return_value))) {
1484+
RETURN_BOOL(S_ISDIR(Z_LVAL_P(return_value)));
1485+
} else {
14821486
if (!allow_links
14831487
&& !(intern->flags & SPL_FILE_DIR_FOLLOW_SYMLINKS)) {
14841488
RETURN_FALSE;
14851489
}
1486-
php_stat(intern->file_name, FS_PERMS, return_value);
1490+
php_stat(intern->file_name, FS_IS_DIR, return_value);
14871491
}
1488-
RETURN_BOOL(S_ISDIR(Z_LVAL_P(return_value)));
14891492
}
14901493
}
14911494
/* }}} */

ext/standard/filestat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ PHP_FUNCTION(clearstatcache)
715715
/* }}} */
716716

717717
#define IS_LINK_OPERATION(__t) ((__t) == FS_TYPE || (__t) == FS_IS_LINK || (__t) == FS_LSTAT || (__t) == FS_LPERMS)
718-
#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK)
718+
#define IS_EXISTS_CHECK(__t) ((__t) == FS_EXISTS || (__t) == FS_IS_W || (__t) == FS_IS_R || (__t) == FS_IS_X || (__t) == FS_IS_FILE || (__t) == FS_IS_DIR || (__t) == FS_IS_LINK || (__t) == FS_LPERMS)
719719
#define IS_ABLE_CHECK(__t) ((__t) == FS_IS_R || (__t) == FS_IS_W || (__t) == FS_IS_X)
720720
#define IS_ACCESS_CHECK(__t) (IS_ABLE_CHECK(type) || (__t) == FS_EXISTS)
721721

0 commit comments

Comments
 (0)