Skip to content

Throw a ValueError when the parameter includes NUL bytes in strptime#21830

Closed
LamentXU123 wants to merge 1 commit intophp:masterfrom
LamentXU123:bug-fix-3
Closed

Throw a ValueError when the parameter includes NUL bytes in strptime#21830
LamentXU123 wants to merge 1 commit intophp:masterfrom
LamentXU123:bug-fix-3

Conversation

@LamentXU123
Copy link
Copy Markdown
Contributor

<?php
echo strptime("2024-01-11\0UTC", "%Y-%m-%d")['unparsed'];
echo strptime("2024-01-11UTC", "%Y-%m-%d")['unparsed'];

resulted in:

UTC

Actually the ValueError-type changes can be done in bulk in the future. However, strptime is now deprecated so I don't sure if we should update this function as well. Feel free to close this if this shouldn't be done on deprecated functions


?>
--EXPECTF--
Deprecated: Function strptime() is deprecated since 8.2, use date_parse_from_format() (for locale-independent parsing), or IntlDateFormatter::parse() (for locale-dependent parsing) instead in %s on line %d
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure it is worth it in that case because ^

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah me too. Not sure if this should be done in deprecated functions

@Girgias
Copy link
Copy Markdown
Member

Girgias commented Apr 22, 2026

I don't think it's worth to this in a function that has been deprecated for a while and will probably soon be removed anyway.

@Girgias Girgias closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants