Skip to content

Commit 6f26102

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Revert "Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject" Revert "Update FreeBSD CI image."
2 parents da8bfd4 + e67336f commit 6f26102

10 files changed

+20
-229
lines changed

ext/spl/spl_directory.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,21 +1914,22 @@ static zend_result spl_filesystem_file_read_ex(spl_filesystem_object *intern, bo
19141914
}
19151915

19161916
if (!buf) {
1917-
return FAILURE;
1918-
}
1919-
1920-
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_DROP_NEW_LINE)) {
1921-
if (line_len > 0 && buf[line_len - 1] == '\n') {
1922-
line_len--;
1923-
if (line_len > 0 && buf[line_len - 1] == '\r') {
1917+
intern->u.file.current_line = estrdup("");
1918+
intern->u.file.current_line_len = 0;
1919+
} else {
1920+
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_DROP_NEW_LINE)) {
1921+
if (line_len > 0 && buf[line_len - 1] == '\n') {
19241922
line_len--;
1923+
if (line_len > 0 && buf[line_len - 1] == '\r') {
1924+
line_len--;
1925+
}
1926+
buf[line_len] = '\0';
19251927
}
1926-
buf[line_len] = '\0';
19271928
}
1928-
}
19291929

1930-
intern->u.file.current_line = buf;
1931-
intern->u.file.current_line_len = line_len;
1930+
intern->u.file.current_line = buf;
1931+
intern->u.file.current_line_len = line_len;
1932+
}
19321933
intern->u.file.current_line_num += line_add;
19331934

19341935
return SUCCESS;

ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_basic.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ fclose($fp);
1313

1414
$fo = new SplFileObject('SplFileObject__fgetcsv1.csv');
1515
var_dump($fo->fgetcsv());
16-
var_dump($fo->fgetcsv());
1716
?>
1817
--CLEAN--
1918
<?php
@@ -30,4 +29,3 @@ array(4) {
3029
[3]=>
3130
string(1) "5"
3231
}
33-
bool(false)

ext/spl/tests/SplFileObject/SplFileObject_key_error001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ var_dump($s->key());
1818
var_dump($s->valid());
1919
?>
2020
--EXPECT--
21-
int(12)
21+
int(14)
2222
bool(false)

ext/spl/tests/SplFileObject/SplFileObject_key_error002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ var_dump($s->key());
1818
var_dump($s->valid());
1919
?>
2020
--EXPECT--
21-
int(12)
21+
int(13)
2222
bool(false)

ext/spl/tests/bug81477.phpt renamed to ext/spl/tests/SplFileObject/bug81477.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ string(8) "baz,bat
2121
"
2222
string(10) "more,data
2323
"
24+
string(0) ""
2425
--CLEAN--
2526
<?php
2627
@unlink(__DIR__ . '/bug81477.csv');

ext/spl/tests/SplFileObject/fgetcsv_file_empty_lines.phpt

Lines changed: 0 additions & 38 deletions
This file was deleted.

ext/spl/tests/SplFileObject/fileobject_001.phpt

Lines changed: 0 additions & 86 deletions
This file was deleted.

ext/spl/tests/SplFileObject/foreach_file_empty_lines.phpt

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
id,status,on_sale,brand,name,link,meta_title,meta_desc,description
2-
1,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
3-
2,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
4-
3,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
5-
4,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
1+
id,status,on_sale,brand,name,link,meta_title,meta_desc,description
2+
1,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
3+
2,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
4+
3,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
5+
4,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32

ext/spl/tests/SplFileObject/gh8563.phpt

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)