php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46312 function empty() on datetime doesn't work correctly
Submitted: 2008-10-16 10:05 UTC Modified: 2011-01-02 02:08 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: remco at mailstreet dot nl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: Apache/2.0.63 (Unix) mod_ssl/2.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: remco at mailstreet dot nl
New email:
PHP Version: OS:

 

 [2008-10-16 10:05 UTC] remco at mailstreet dot nl
Description:
------------
if i toggle something like this it doesn't give me the result i would suspect to get:

$dateTime is a mysql datetime string like :'0000-00-00 00:00:00'

Wich should be equal to empty and not null


Reproduce code:
---------------
$dateTime = '0000-00-00 00:00:00';

if(empty($dateTime)){
  $dateSet = false;
} else {
  $dateSet = true;
}

var_export($dateSet);





Expected result:
----------------
// $dateSet = tue; wich i believe should be false

false

Actual result:
--------------
// $dateSet = tue; wich i believe should be false


true

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-02 02:08 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2011-01-02 02:08 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 14:00:03 2025 UTC