@@ -2047,13 +2047,14 @@ static bool spl_filesystem_file_is_empty_line(spl_filesystem_object *intern) /*
2047
2047
}
2048
2048
/* }}} */
2049
2049
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 ) /* {{{ */
2051
2052
{
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 );
2053
2054
2054
2055
while (SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_SKIP_EMPTY ) && ret == SUCCESS && spl_filesystem_file_is_empty_line (intern )) {
2055
2056
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 );
2057
2058
}
2058
2059
2059
2060
return ret ;
@@ -2075,7 +2076,7 @@ static void spl_filesystem_file_rewind(zval * this_ptr, spl_filesystem_object *i
2075
2076
intern -> u .file .current_line_num = 0 ;
2076
2077
2077
2078
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 );
2079
2080
}
2080
2081
} /* }}} */
2081
2082
@@ -2229,7 +2230,7 @@ PHP_METHOD(SplFileObject, current)
2229
2230
CHECK_SPL_FILE_OBJECT_IS_INITIALIZED (intern );
2230
2231
2231
2232
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 );
2233
2234
}
2234
2235
if (intern -> u .file .current_line && (!SPL_HAS_FLAG (intern -> flags , SPL_FILE_OBJECT_READ_CSV ) || Z_ISUNDEF (intern -> u .file .current_zval ))) {
2235
2236
RETURN_STRINGL (intern -> u .file .current_line , intern -> u .file .current_line_len );
@@ -2251,7 +2252,7 @@ PHP_METHOD(SplFileObject, key)
2251
2252
2252
2253
/* Do not read the next line to support correct counting with fgetc()
2253
2254
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);
2255
2256
} */
2256
2257
RETURN_LONG (intern -> u .file .current_line_num );
2257
2258
} /* }}} */
@@ -2267,7 +2268,7 @@ PHP_METHOD(SplFileObject, next)
2267
2268
2268
2269
spl_filesystem_file_free_line (intern );
2269
2270
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 );
2271
2272
}
2272
2273
intern -> u .file .current_line_num ++ ;
2273
2274
} /* }}} */
@@ -2766,7 +2767,7 @@ PHP_METHOD(SplFileObject, seek)
2766
2767
spl_filesystem_file_rewind (ZEND_THIS , intern );
2767
2768
2768
2769
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 ) {
2770
2771
return ;
2771
2772
}
2772
2773
}
0 commit comments