From:             martin dot contento at gmail dot com
Operating system: linux
PHP version:      5.2.5
PHP Bug Type:     Date/time related
Bug description:  date_create never fails (even when it should)

Description:
------------
As "karsten" already mentioned
(http://de.php.net/manual/en/function.date-create.php#77871) date_create()
never returns FALSE like it is supposed to, even when it is handed complete
garbage. It seems to be something like "if the string starts with a letter,
treat it as a timezone -> this is not a timezone *dies*)

edit:
also, this bug might be related: http://bugs.php.net/bug.php?id=40340

Reproduce code:
---------------
<?php

$date = date_create('asdfasdf');

if ($date instanceof DateTime {
  echo "this is wrong, should be bool";
}

?>

Expected result:
----------------
nothing (i would expect date_create() to handle the error in the timezone
function and return FALSE)

Actual result:
--------------
Warning: date_create(): Failed to parse time string (asdfasdf) at position
0 (a): The timezone could not be found in the database in
/home/mcontento/datetimebug.php on line 3

-- 
Edit bug report at http://bugs.php.net/?id=43808&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43808&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43808&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43808&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43808&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43808&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43808&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43808&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43808&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43808&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43808&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43808&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43808&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43808&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43808&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43808&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43808&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43808&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43808&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43808&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43808&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43808&r=mysqlcfg

Reply via email to