Skip to content

Commit f2364f3

Browse files
committed
SplFileObject::fgets() cannot return false
spl_filesystem_file_read() is called with silent=0, so it will throw on failure.
1 parent 7290dc4 commit f2364f3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

ext/spl/spl_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ PHP_METHOD(SplFileObject, fgets)
21962196
CHECK_SPL_FILE_OBJECT_IS_INITIALIZED(intern);
21972197

21982198
if (spl_filesystem_file_read(intern, 0) == FAILURE) {
2199-
RETURN_FALSE;
2199+
RETURN_THROWS();
22002200
}
22012201
RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len);
22022202
} /* }}} */

ext/spl/spl_directory.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function eof() {}
199199
/** @return bool */
200200
public function valid() {}
201201

202-
/** @return string|false */
202+
/** @return string */
203203
public function fgets() {}
204204

205205
/** @return string|false */
@@ -281,7 +281,7 @@ public function getChildren() {}
281281
public function seek(int $line) {}
282282

283283
/**
284-
* @return string|false
284+
* @return string
285285
* @alias SplFileObject::fgets
286286
*/
287287
public function getCurrentLine() {}

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: b4aa4816381e8380d5dc0c5f9b9969992a72f9ed */
2+
* Stub hash: 285af54cf7b3f3ef3f0d673b248c5afbd4cc440e */
33

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

0 commit comments

Comments
 (0)