summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-01-18 16:47:04 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-01-18 16:47:21 +0100
commitf2364f316d37334192fc6575b2de4144c8039c2f (patch)
tree4ffccfff7b4e444a1daa46ec97b36dfd6bd9bb9a
parent7290dc4dcf25d4a37fc1d412a5b5a8828cc06c77 (diff)
downloadphp-git-f2364f316d37334192fc6575b2de4144c8039c2f.tar.gz
SplFileObject::fgets() cannot return false
spl_filesystem_file_read() is called with silent=0, so it will throw on failure.
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/spl_directory.stub.php4
-rw-r--r--ext/spl/spl_directory_arginfo.h2
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)