Skip to content

Commit a055c54

Browse files
committed
Remove silent argument to spl_filesystem_file_read_line()
true was always passed to it
1 parent f905590 commit a055c54

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

ext/spl/spl_directory.c

+9-8
Original file line numberDiff line numberDiff line change
@@ -2047,13 +2047,14 @@ static bool spl_filesystem_file_is_empty_line(spl_filesystem_object *intern) /*
20472047
}
20482048
/* }}} */
20492049

2050-
static zend_result spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object *intern, bool silent) /* {{{ */
2050+
/* Call to this function reads a line in a "silent" fashion and does not throw an exception */
2051+
static zend_result spl_filesystem_file_read_line(zval * this_ptr, spl_filesystem_object *intern) /* {{{ */
20512052
{
2052-
zend_result ret = spl_filesystem_file_read_line_ex(this_ptr, intern, silent);
2053+
zend_result ret = spl_filesystem_file_read_line_ex(this_ptr, intern, /* silent */ true);
20532054

20542055
while (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_SKIP_EMPTY) && ret == SUCCESS && spl_filesystem_file_is_empty_line(intern)) {
20552056
spl_filesystem_file_free_line(intern);
2056-
ret = spl_filesystem_file_read_line_ex(this_ptr, intern, silent);
2057+
ret = spl_filesystem_file_read_line_ex(this_ptr, intern, /* silent */ true);
20572058
}
20582059

20592060
return ret;
@@ -2075,7 +2076,7 @@ static void spl_filesystem_file_rewind(zval * this_ptr, spl_filesystem_object *i
20752076
intern->u.file.current_line_num = 0;
20762077

20772078
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) {
2078-
spl_filesystem_file_read_line(this_ptr, intern, /* silent */ true);
2079+
spl_filesystem_file_read_line(this_ptr, intern);
20792080
}
20802081
} /* }}} */
20812082

@@ -2229,7 +2230,7 @@ PHP_METHOD(SplFileObject, current)
22292230
CHECK_SPL_FILE_OBJECT_IS_INITIALIZED(intern);
22302231

22312232
if (!intern->u.file.current_line && Z_ISUNDEF(intern->u.file.current_zval)) {
2232-
spl_filesystem_file_read_line(ZEND_THIS, intern, /* silent */ true);
2233+
spl_filesystem_file_read_line(ZEND_THIS, intern);
22332234
}
22342235
if (intern->u.file.current_line && (!SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) || Z_ISUNDEF(intern->u.file.current_zval))) {
22352236
RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len);
@@ -2251,7 +2252,7 @@ PHP_METHOD(SplFileObject, key)
22512252

22522253
/* Do not read the next line to support correct counting with fgetc()
22532254
if (!intern->u.file.current_line) {
2254-
spl_filesystem_file_read_line(ZEND_THIS, intern, silent true);
2255+
spl_filesystem_file_read_line(ZEND_THIS, intern);
22552256
} */
22562257
RETURN_LONG(intern->u.file.current_line_num);
22572258
} /* }}} */
@@ -2267,7 +2268,7 @@ PHP_METHOD(SplFileObject, next)
22672268

22682269
spl_filesystem_file_free_line(intern);
22692270
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_AHEAD)) {
2270-
spl_filesystem_file_read_line(ZEND_THIS, intern, /* silent */ true);
2271+
spl_filesystem_file_read_line(ZEND_THIS, intern);
22712272
}
22722273
intern->u.file.current_line_num++;
22732274
} /* }}} */
@@ -2766,7 +2767,7 @@ PHP_METHOD(SplFileObject, seek)
27662767
spl_filesystem_file_rewind(ZEND_THIS, intern);
27672768

27682769
for (i = 0; i < line_pos; i++) {
2769-
if (spl_filesystem_file_read_line(ZEND_THIS, intern, /* silent */ true) == FAILURE) {
2770+
if (spl_filesystem_file_read_line(ZEND_THIS, intern) == FAILURE) {
27702771
return;
27712772
}
27722773
}

0 commit comments

Comments
 (0)