|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-09-02 11:18 UTC] lol at reddit dot com
[2019-09-02 21:15 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-09-02 21:15 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 14:00:02 2026 UTC |
Description: ------------ DateTime::__construct and its alias, date_create function, are returning weird results for the following cases: 1. date_create('test') => returns false, which is expected according to documentation; 2. date_create('a test') => retuns the DateTime object constructed as "new DateTime('now')", which is not expected. Same is valid for new DateTime() process: 1. new DateTime('test') => throws Exception, which is expected according to documentation; 2. new DateTime('a test') = retuns the DateTime object constructed as "new DateTime('now')", which is not expected. Test script: --------------- php -r "var_dump(date_create('test')); // EXPECTED result" php -r "var_dump(date_create('a test')); // UNEXPECTED result" Expected result: ---------------- For the script below it should return FALSE also: php -r "var_dump(date_create('a test')); // UNEXPECTED result" Actual result: -------------- For the script below it returns DateTime object constructed as "new DateTime('now')": php -r "var_dump(date_create('a test')); // UNEXPECTED result"