|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-05-10 19:43 UTC] theanomaly dot is at gmail dot com
[2016-06-22 18:00 UTC] cmb@php.net
-Package: Feature/Change Request
+Package: *General Issues
[2016-06-22 18:00 UTC] cmb@php.net
[2024-07-11 11:35 UTC] chris1058wright at outlook dot com
[2024-07-13 07:27 UTC] Victoria476Huff at outlook dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
Description: ------------ Currently file() only skips (FILE_SKIP_EMPTY_LINES) when also using FILE_IGNORE_NEW_LINES at the same time. I think it would be preferable if it would work without that flag too, ignoring lines only consisting of a newline. Patch diff -u -r1.409.2.6.2.17 file.c --- ext/standard/file.c 23 Feb 2007 16:22:20 -0000 1.409.2.6.2.17 +++ ext/standard/file.c 7 May 2007 16:17:27 -0000 @@ -750,6 +750,10 @@ do { p++; parse_eol: + if (skip_blank_lines && (p-s == 1) && (*s == eol_marker)) { + s = p; + continue; + } if (PG(magic_quotes_runtime)) { /* s is in target_buf which is freed at the end of the function */ slashed = php_addslashes(s, (p-s), &len, 0 TSRMLS_CC); Reproduce code: --------------- Input file x: a b Code: var_dump(file("x", FILE_SKIP_EMPTY_LINES)); Expected result: ---------------- a b Actual result: -------------- a b