php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78616 unexpected behaviour of date function
Submitted: 2019-10-01 06:45 UTC Modified: 2019-10-01 07:42 UTC
From: tanmuhittin at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: ubuntu
Private report: No CVE-ID: None
 [2019-10-01 06:45 UTC] tanmuhittin at gmail dot com
Description:
------------
especially when using date function with strtotime this behavior may result problems since strtotime returns false when invalid argument is supplied but date function will not

Test script:
---------------
<?php
echo date('Y-m-d',false);
echo date('Y-m-d',0);

Expected result:
----------------
false
01-01-1970

Actual result:
--------------
01-01-1970
01-01-1970

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-01 07:42 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-10-01 07:42 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

See <https://www.php.net/manual/en/language.types.integer.php#language.types.integer.casting.from-boolean>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC