#106933DateTimeConverter: Null-Byte in source variable leads to exception
Description
The class DateTimeConverter of extbase leads to an exception if the parameter source is a string and contains the null byte character \0.
DateTime::createFromFormat(): Argument #2 ($datetime) must not contain any null bytes
Strings containing the null byte character are valid strings, but can not handled by the by the DateTime::createFromFormat method of PHP.
A simple solution to this issue would be to trim the value of parameter source and assign the return value to variable $dateAsString
This issue occures due to a test of a form element, but is not limited to that.
See:Reviews 2
History 35
-
Benni Mack commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-07-25T15:56:48+00:00" > 07/25/25, 15:56 </span> -
Lars Tode commented <span data-processor="relativetime" data-value="2025-07-28T09:38:23+00:00" > 07/28/25, 09:38 </span>
Benni Mack wrote in #note-1:
> this sounds like a PHP Bug? Otherwise I think we would rather create a wrapper around DateTime and build our own to remove special characters, but that seems like a workaround. How did such a use-case happen?I am not sure, the issue was logged in sentry.
As a guess, this could happend due to copy and paste by a visitor, editor or by a script.
Another trigger could be the use of the internal API.Another solution would be catching the exception and log a possible reason for the exception.
-
Gerrit Code Review pushed patch set 1 for main to change 96295 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2026-10-02T07:07:19+00:00" > 10/02/26, 07:07 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 97014 <span data-processor="relativetime" data-value="2026-10-22T15:52:11+00:00" > 10/22/26, 15:52 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-22T15:57:01+00:00" > 10/22/26, 15:57 </span>Applied in changeset commit:08bb7f4a25382c1abe714b5fbff77abbaf82a427.
Hey Lars,
this sounds like a PHP Bug? Otherwise I think we would rather create a wrapper around DateTime and build our own to remove special characters, but that seems like a workaround. How did such a use-case happen?