Skip to content

Incorrect timestamp parsing #8809

@GrahamCampbell

Description

@GrahamCampbell

Description

The following code:

<?php

new DateTimeImmutable('2022-123-20 22:00');

Resulted in this output:

But I expected this output instead:

Fatal error: Uncaught Exception: Failed to parse time string (2022-123-20 22:00) at position 7 (3): Unexpected character in /in/fFt1B:3
Stack trace:
#0 /in/fFt1B(3): DateTimeImmutable->__construct('2022-123-20 22:...')
#1 {main}
  thrown in /in/fFt1B on line 3

PHP Version

8.1.7

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions