From f2364f316d37334192fc6575b2de4144c8039c2f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 18 Jan 2021 16:47:04 +0100 Subject: SplFileObject::fgets() cannot return false spl_filesystem_file_read() is called with silent=0, so it will throw on failure. --- ext/spl/spl_directory.c | 2 +- ext/spl/spl_directory.stub.php | 4 ++-- ext/spl/spl_directory_arginfo.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 7d9ea9cc2b..b7a835ae45 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2196,7 +2196,7 @@ PHP_METHOD(SplFileObject, fgets) CHECK_SPL_FILE_OBJECT_IS_INITIALIZED(intern); if (spl_filesystem_file_read(intern, 0) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len); } /* }}} */ diff --git a/ext/spl/spl_directory.stub.php b/ext/spl/spl_directory.stub.php index 094b278d21..681547e55f 100644 --- a/ext/spl/spl_directory.stub.php +++ b/ext/spl/spl_directory.stub.php @@ -199,7 +199,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt /** @return bool */ public function valid() {} - /** @return string|false */ + /** @return string */ public function fgets() {} /** @return string|false */ @@ -281,7 +281,7 @@ class SplFileObject extends SplFileInfo implements RecursiveIterator, SeekableIt public function seek(int $line) {} /** - * @return string|false + * @return string * @alias SplFileObject::fgets */ public function getCurrentLine() {} diff --git a/ext/spl/spl_directory_arginfo.h b/ext/spl/spl_directory_arginfo.h index c0d80f0ae6..a16c4d45d0 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: b4aa4816381e8380d5dc0c5f9b9969992a72f9ed */ + * Stub hash: 285af54cf7b3f3ef3f0d673b248c5afbd4cc440e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFileInfo___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) -- cgit v1.2.1