From ba4cbbaf6990a9f827c5d8cc99bfcedb7731cf13 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Mon, 19 Feb 2007 20:34:29 +0000 Subject: [PATCH] - Bugfix #40546: SplFileInfo::getPathInfo() throws an execption if directory is in root dir. --- NEWS | 4 +++- ext/spl/spl_directory.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index dbdfbac38e..75b672701f 100644 --- a/NEWS +++ b/NEWS @@ -6,9 +6,11 @@ PHP NEWS . libpq (PostgreSQL) to version 8.2.3 - Upgraded SQLite 3 to version 3.3.12 (Ilia) - Upgraded PCRE to version 7.0 (Nuno) -- Add --ri switch to CLI which allows to check extension information. (Marcus) +- Added --ri switch to CLI which allows to check extension information. (Marcus) - Added tidyNode::getParent() method (John, Nuno) - Fixed zend_llist_remove_tail (Michael Wallner, Dmitry) +- Fixed bug #40546 (SplFileInfo::getPathInfo() throws an execption if directory + is in root dir). (Marcus) - Fixed bug #40503 (json_encode() value corruption on 32bit systems with overflown values). (Ilia) - Fixed bug #40467 (Partial SOAP request sent when XSD sequence or choice diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 82d727e87d..0cd440c758 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -319,14 +319,23 @@ static spl_filesystem_object * spl_filesystem_object_create_info(spl_filesystem_ { spl_filesystem_object *intern; zval *arg1; - + if (!file_path || !file_path_len) { +#if defined(PHP_WIN32) zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot create SplFileInfo for empty path"); if (file_path && !use_copy) { efree(file_path); } return NULL; +#else + if (file_path && !use_copy) { + efree(file_path); + } + use_copy = 1; + file_path_len = 1; + file_path = "/"; +#endif } php_set_error_handling(EH_THROW, spl_ce_RuntimeException TSRMLS_CC); -- 2.50.1