]> granicus.if.org Git - php/commitdiff
SplFileObject::fgets() cannot return false
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 18 Jan 2021 15:47:04 +0000 (16:47 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 18 Jan 2021 15:47:21 +0000 (16:47 +0100)
spl_filesystem_file_read() is called with silent=0, so it will
throw on failure.

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

index 7d9ea9cc2bfaa65eeac42bca4281804db51d05f3..b7a835ae456737f664586ff6cb2dd0422daf6af4 100644 (file)
@@ -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);
 } /* }}} */
index 094b278d21dc8135a2f58760384bc1e9a7699b01..681547e55f71e37bf42988b37c75bcd0b5d04497 100644 (file)
@@ -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() {}
index c0d80f0ae69c46d6003cbde8ca1ae51f1dc8de9a..a16c4d45d06c8a01408ee012fa6ad4ceb8a6fae4 100644 (file)
@@ -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)