From: Nikita Popov Date: Fri, 14 Aug 2020 08:52:34 +0000 (+0200) Subject: Return empty string from SplFileInfo::getPathname() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07539685b9bb18fb3eae56ed8fcdc3ab36495c19;p=php Return empty string from SplFileInfo::getPathname() Instead of false. This is consistent with how other methods like SplFileInfo::getPath() behave. It's also a requirement before SplFileInfo::__toString() calls SplFileInfo::getPathname() and needs to return a string. --- diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 1490bf1a7f..93299470c9 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1045,7 +1045,7 @@ PHP_METHOD(SplFileInfo, getPathname) if (path != NULL) { RETURN_STRINGL(path, path_len); } else { - RETURN_FALSE; + RETURN_EMPTY_STRING(); } } /* }}} */ diff --git a/ext/spl/spl_directory.stub.php b/ext/spl/spl_directory.stub.php index ce56654eb6..3d4f396922 100755 --- a/ext/spl/spl_directory.stub.php +++ b/ext/spl/spl_directory.stub.php @@ -18,7 +18,7 @@ class SplFileInfo /** @return string */ public function getBasename(string $suffix = "") {} - /** @return string|false */ + /** @return string */ public function getPathname() {} /** @return int|false */ diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index 57b096caf7..0208156759 100644 --- a/ext/spl/spl_directory_arginfo.h +++ b/ext/spl/spl_directory_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 55701f921c7df2f344dd6b110558fd97efec9891 */ + * Stub hash: 444071056e55fdc44d76db009c92b4d06eba81fb */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)