Bug #74482 [NEW]: Missing validation of date in DateTime::createFromFormat
From: spam at bugyik dot cz
Operating system: Linux
PHP version: 7.1.4
Package: Date/time related
Bug Type: Bug
Bug description:Missing validation of date in DateTime::createFromFormat
Description:
------------
I'm missing validation of date-time in DateTime::createFromFormat. The
example below tells more.
Test script:
---------------
<?php
var_dump(\DateTime::createFromFormat(\DateTime::RFC3339,
'2017-99-99T08:51:13-03:00'));
Expected result:
----------------
some exception expected (like from new DateTime('bad-time'))
Actual result:
--------------
object(DateTime)#1 (3) {
["date"]=>
string(26) "2025-06-07 08:51:13.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "-03:00"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74482&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74482&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74482&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74482&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74482&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74482&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74482&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74482&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74482&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74482&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74482&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74482&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74482&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74482&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74482&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74482&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74482&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74482&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74482&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74482&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74482&r=mysqlcfg
Thread (6 messages)
- spam at bugyik dot cz