From 9201fa6918d40a072e11c20a6435e00e3a0cb490 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 23 Jan 2006 15:24:41 +0000 Subject: [PATCH] MFB51: Fixed bug #36134 (DirectoryIterator constructor failed to detect empty directory names). --- ext/spl/spl_directory.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index a3290f02d9..ca31530503 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -393,6 +393,12 @@ SPL_METHOD(DirectoryIterator, __construct) return; } + if (!len) { + php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC); + zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Directory name must not be empty."); + return; + } + intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_dir_open(intern, path TSRMLS_CC); intern->u.dir.is_recursive = instanceof_function(intern->std.ce, U_CLASS_ENTRY(spl_ce_RecursiveDirectoryIterator) TSRMLS_CC) ? 1 : 0; -- 2.50.1