Fix GH-18120: Honor FILE_SKIP_EMPTY_LINES even when FILE_IGNORE_NEW_LINES is not set#19346
Open
alexandre-daubois wants to merge 2 commits intophp:masterfrom
Open
Fix GH-18120: Honor FILE_SKIP_EMPTY_LINES even when FILE_IGNORE_NEW_LINES is not set#19346alexandre-daubois wants to merge 2 commits intophp:masterfrom
FILE_SKIP_EMPTY_LINES even when FILE_IGNORE_NEW_LINES is not set#19346alexandre-daubois wants to merge 2 commits intophp:masterfrom
Conversation
0294ac1 to
feea545
Compare
feea545 to
c783b4b
Compare
c783b4b to
95211df
Compare
Member
Author
|
Friendly ping @DanielEScherzer @nielsdos as you participated on the issue 🙂 |
Member
|
I'll play with this tomorrow or so. Note that this is fixing long standing behaviour, so targeting 8.5/master is likely more appropriate. |
Member
|
^ what @nielsdos said about not targeting 8.3, but wearing my release manager hat I don't think 8.5 is appropriate |
Member
<?php
$test_file = __DIR__ . "/file_skip_empty_lines.tmp";
$test_data = "\r";
file_put_contents($test_file, $test_data);
$lines = file($test_file, FILE_SKIP_EMPTY_LINES);
var_dump($lines);
$test_data = "\r\r";
file_put_contents($test_file, $test_data);
$lines = file($test_file, FILE_SKIP_EMPTY_LINES);
var_dump($lines);produces: which seems incorrect to me. Can you explain whether this is the desired behaviour? |
95211df to
25718ef
Compare
…_NEW_LINES` is not set
25718ef to
43d24d1
Compare
d8ff4fd to
daf2b51
Compare
Member
Author
|
@ndossche I addressed your concern and updated the test file as well. Also, I rebased on master as suggested. |
ndossche
requested changes
Dec 5, 2025
daf2b51 to
f0e3236
Compare
Member
|
This still acts in a way I don't expect: $test_data = "\r\r\n\n";
file_put_contents($test_file, $test_data);
$lines = file($test_file, FILE_SKIP_EMPTY_LINES);
var_dump($lines);There are only empty lines in this test file, so the output should be an empty array. Am I misunderstanding something? Admittingly it's been a while since I looked at this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #18120
Allows to use
FILE_SKIP_EMPTY_LINESwithoutFILE_IGNORE_NEW_LINES: