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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tanmuhittin at gmail dot com
New email:
PHP Version: OS:

 

 [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: Fri Apr 26 08:01:30 2024 UTC