Skip to content

Commit

Permalink
Return empty string from SplFileInfo::getPathname()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Aug 14, 2020
1 parent 0a439fa commit 0753968
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ PHP_METHOD(SplFileInfo, getPathname)
if (path != NULL) {
RETURN_STRINGL(path, path_len);
} else {
RETURN_FALSE;
RETURN_EMPTY_STRING();
}
}
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_directory.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function getExtension() {}
/** @return string */
public function getBasename(string $suffix = "") {}

/** @return string|false */
/** @return string */
public function getPathname() {}

/** @return int|false */
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_directory_arginfo.h
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 0753968

Please sign in to comment.