]> granicus.if.org Git - php/commitdiff
Fixed bug #36134 (DirectoryIterator constructor failed to detect empty
authorIlia Alshanetsky <iliaa@php.net>
Mon, 23 Jan 2006 15:24:10 +0000 (15:24 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 23 Jan 2006 15:24:10 +0000 (15:24 +0000)
directory names).

NEWS
ext/spl/spl_directory.c

diff --git a/NEWS b/NEWS
index e6fdf2fb3061d14b337719cdd1a06b5493dcf8ed..7efb32aaaca71dd0d288502916470d3a4c7f3cd2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ PHP                                                                        NEWS
   MYSQLI_TYPE_NEWDECIMAL and MYSQLI_TYPE_BIT. FR #36007. (Georg)
 - Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE
   on error. (Pierre)
+- Fixed bug #36134 (DirectoryIterator constructor failed to detect empty 
+  directory names). (Ilia)
 - Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed). 
   (Tony)
 - Fixed bug #36071 (Engine Crash related with 'clone'). (Dmitry)
index 3295e215582d0f1027bb6fd474261e432c19696e..249f42700622d750085cc23b11ba345c1a0fd129 100755 (executable)
@@ -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, spl_ce_RecursiveDirectoryIterator TSRMLS_CC) ? 1 : 0;