]> granicus.if.org Git - php/commitdiff
Return empty string from SplFileInfo::getPathname()
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Aug 2020 08:52:34 +0000 (10:52 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Aug 2020 09:09:30 +0000 (11:09 +0200)
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.

ext/spl/spl_directory.c
ext/spl/spl_directory.stub.php
ext/spl/spl_directory_arginfo.h

index 1490bf1a7f3e19e8fd1534af03cde0d40e2df20d..93299470c93114508bd17d48438acd8dd468d249 100644 (file)
@@ -1045,7 +1045,7 @@ PHP_METHOD(SplFileInfo, getPathname)
        if (path != NULL) {
                RETURN_STRINGL(path, path_len);
        } else {
-               RETURN_FALSE;
+               RETURN_EMPTY_STRING();
        }
 }
 /* }}} */
index ce56654eb62f1e7fb7ec6c71187384beaca8f9e2..3d4f3969223bf15eb1ce100b779da467ca823c51 100755 (executable)
@@ -18,7 +18,7 @@ class SplFileInfo
     /** @return string */
     public function getBasename(string $suffix = "") {}
 
-    /** @return string|false */
+    /** @return string */
     public function getPathname() {}
 
     /** @return int|false */
index 57b096caf71f9361216e8af16bcb1c4243a54c0c..02081567593d8ef7ccd795cee8e19cb52ca0e4c4 100644 (file)
@@ -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)