Skip to content

Commit 0753968

Browse files
committed
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.
1 parent 0a439fa commit 0753968

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ext/spl/spl_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ PHP_METHOD(SplFileInfo, getPathname)
10451045
if (path != NULL) {
10461046
RETURN_STRINGL(path, path_len);
10471047
} else {
1048-
RETURN_FALSE;
1048+
RETURN_EMPTY_STRING();
10491049
}
10501050
}
10511051
/* }}} */

ext/spl/spl_directory.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getExtension() {}
1818
/** @return string */
1919
public function getBasename(string $suffix = "") {}
2020

21-
/** @return string|false */
21+
/** @return string */
2222
public function getPathname() {}
2323

2424
/** @return int|false */

ext/spl/spl_directory_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 55701f921c7df2f344dd6b110558fd97efec9891 */
2+
* Stub hash: 444071056e55fdc44d76db009c92b4d06eba81fb */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, file_name, IS_STRING, 0)

0 commit comments

Comments
 (0)