Skip to content

Fix #80933: SplFileObject::fgets() stops at NUL byte for DROP_NEW_LINE#6836

Closed
cmb69 wants to merge 6 commits intophp:PHP-7.4from
cmb69:cmb/80933
Closed

Fix #80933: SplFileObject::fgets() stops at NUL byte for DROP_NEW_LINE#6836
cmb69 wants to merge 6 commits intophp:PHP-7.4from
cmb69:cmb/80933

Conversation

@cmb69
Copy link
Member

@cmb69 cmb69 commented Apr 5, 2021

buf may contain NUL bytes, so we must not use strcspn() but rather
the binary safe php_strcspn().

Signed-off-by: Christoph M. Becker [email protected]

`buf` may contain NUL bytes, so we must not use `strcspn()` but rather
the binary safe `php_strcspn()`.

Signed-off-by: Christoph M. Becker <[email protected]>
@cmb69 cmb69 added the Bug label Apr 5, 2021
@cmb69 cmb69 marked this pull request as draft April 5, 2021 16:44
`php_strcspn()` expects `char*`s prior to PHP 8.0.0.

Signed-off-by: Christoph M. Becker <[email protected]>
@cmb69 cmb69 marked this pull request as ready for review April 5, 2021 20:36
We must not assume that either CR or LF are valid line endings, but
should use `php_stream_locate_eol()` in the first place.
@cmb69
Copy link
Member Author

cmb69 commented Apr 7, 2021

Like mentioned in the bug report, there is a more general issue regarding the detection of valid line endings. This should be addressed by my latest commit.

@cmb69 cmb69 closed this in 976e71a Apr 13, 2021
@cmb69 cmb69 deleted the cmb/80933 branch April 13, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants