You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
str_getcsv returns null byte for unterminated quoted string #11982
This behaviour dates back to its introduction in PHP 5.3, at this point I think the ship has sailed on "sensible" behaviour for this function. I really need to go back and work onext/csv.
I have done some debugging and I think this might be actually a bug that is worth a fix. I see the point about the BC as some apps might potentially rely on that but I think we could still fix it in 8.3 potentially. Specifically this output really does not make any sense to me:
As can be seen the current logic is to ignore missing enclosing character at the end. But in the case of empty strings, it prints \0 which seems like a omission in the code to me as it twice increments bptr without checking for end.
The fix for this is in GH-12047 . It took me quite a bit of time to just figure out how that old (created 20 years ago) parser works. At least I have got some knowledge of that now...
Activity
Girgias commentedon Aug 15, 2023
This behaviour dates back to its introduction in PHP 5.3, at this point I think the ship has sailed on "sensible" behaviour for this function. I really need to go back and work onext/csv.
But @bukka what do you think about this?
bukka commentedon Aug 24, 2023
I have done some debugging and I think this might be actually a bug that is worth a fix. I see the point about the BC as some apps might potentially rely on that but I think we could still fix it in 8.3 potentially. Specifically this output really does not make any sense to me:
results to
As can be seen the current logic is to ignore missing enclosing character at the end. But in the case of empty strings, it prints
\0which seems like a omission in the code to me as it twice incrementsbptrwithout checking for end.Fix phpGH-11982: str_getcsv returns null byte for unterminated quoted…
bukka commentedon Aug 25, 2023
The fix for this is in GH-12047 . It took me quite a bit of time to just figure out how that old (created 20 years ago) parser works. At least I have got some knowledge of that now...
Fix phpGH-11982: str_getcsv returns null byte for unterminated quoted…