Skip to content

Commit

Permalink
Merge branch 'PHP-8.1'
Browse files Browse the repository at this point in the history
* PHP-8.1:
  Revert "Fix GH-8563  Different results for seek() on SplFileObject and SplTempFileObject"
  Revert "Update FreeBSD CI image."
  • Loading branch information
Girgias committed Jul 5, 2022
2 parents da8bfd4 + e67336f commit 6f26102
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 229 deletions.
23 changes: 12 additions & 11 deletions ext/spl/spl_directory.c
Expand Up @@ -1914,21 +1914,22 @@ static zend_result spl_filesystem_file_read_ex(spl_filesystem_object *intern, bo
}

if (!buf) {
return FAILURE;
}

if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_DROP_NEW_LINE)) {
if (line_len > 0 && buf[line_len - 1] == '\n') {
line_len--;
if (line_len > 0 && buf[line_len - 1] == '\r') {
intern->u.file.current_line = estrdup("");
intern->u.file.current_line_len = 0;
} else {
if (SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_DROP_NEW_LINE)) {
if (line_len > 0 && buf[line_len - 1] == '\n') {
line_len--;
if (line_len > 0 && buf[line_len - 1] == '\r') {
line_len--;
}
buf[line_len] = '\0';
}
buf[line_len] = '\0';
}
}

intern->u.file.current_line = buf;
intern->u.file.current_line_len = line_len;
intern->u.file.current_line = buf;
intern->u.file.current_line_len = line_len;
}
intern->u.file.current_line_num += line_add;

return SUCCESS;
Expand Down
2 changes: 0 additions & 2 deletions ext/spl/tests/SplFileObject/SplFileObject_fgetcsv_basic.phpt
Expand Up @@ -13,7 +13,6 @@ fclose($fp);

$fo = new SplFileObject('SplFileObject__fgetcsv1.csv');
var_dump($fo->fgetcsv());
var_dump($fo->fgetcsv());
?>
--CLEAN--
<?php
Expand All @@ -30,4 +29,3 @@ array(4) {
[3]=>
string(1) "5"
}
bool(false)
Expand Up @@ -18,5 +18,5 @@ var_dump($s->key());
var_dump($s->valid());
?>
--EXPECT--
int(12)
int(14)
bool(false)
Expand Up @@ -18,5 +18,5 @@ var_dump($s->key());
var_dump($s->valid());
?>
--EXPECT--
int(12)
int(13)
bool(false)
Expand Up @@ -21,6 +21,7 @@ string(8) "baz,bat
"
string(10) "more,data
"
string(0) ""
--CLEAN--
<?php
@unlink(__DIR__ . '/bug81477.csv');
Expand Down
38 changes: 0 additions & 38 deletions ext/spl/tests/SplFileObject/fgetcsv_file_empty_lines.phpt

This file was deleted.

86 changes: 0 additions & 86 deletions ext/spl/tests/SplFileObject/fileobject_001.phpt

This file was deleted.

37 changes: 0 additions & 37 deletions ext/spl/tests/SplFileObject/foreach_file_empty_lines.phpt

This file was deleted.

10 changes: 5 additions & 5 deletions ext/spl/tests/SplFileObject/gh8121.csv
@@ -1,5 +1,5 @@
id,status,on_sale,brand,name,link,meta_title,meta_desc,description
1,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
2,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
3,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
4,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
id,status,on_sale,brand,name,link,meta_title,meta_desc,description
1,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
2,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
3,2,15,Samsung,M21,samsung-m21,Samsung M21,Samsung M21,Samsung M21
4,2,15,Samsung,M32,samsung-m32,Samsung M32,Samsung M32,Samsung M32
48 changes: 0 additions & 48 deletions ext/spl/tests/SplFileObject/gh8563.phpt

This file was deleted.

0 comments on commit 6f26102

Please sign in to comment.