Skip to content

Commit 9cbc3ae

Browse files
author
Ilia Alshanetsky
committed
Fixed bug #36134 (DirectoryIterator constructor failed to detect empty
directory names).
1 parent 2d1d476 commit 9cbc3ae

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
MYSQLI_TYPE_NEWDECIMAL and MYSQLI_TYPE_BIT. FR #36007. (Georg)
1010
- Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE
1111
on error. (Pierre)
12+
- Fixed bug #36134 (DirectoryIterator constructor failed to detect empty
13+
directory names). (Ilia)
1214
- Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed).
1315
(Tony)
1416
- Fixed bug #36071 (Engine Crash related with 'clone'). (Dmitry)

ext/spl/spl_directory.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ SPL_METHOD(DirectoryIterator, __construct)
393393
return;
394394
}
395395

396+
if (!len) {
397+
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
398+
zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Directory name must not be empty.");
399+
return;
400+
}
401+
396402
intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
397403
spl_filesystem_dir_open(intern, path TSRMLS_CC);
398404
intern->u.dir.is_recursive = instanceof_function(intern->std.ce, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;

0 commit comments

Comments
 (0)