From: tj at systisoft dot com
Operating system: Mac OS X
PHP version: 5.3CVS-2008-07-14 (CVS)
PHP Bug Type: Date/time related
Bug description: create_date_from_format cannot parse negative (BC) dates
Description:
------------
While the constructor of DateTime can handle negaive dates (BC dates),
create_date_from_format cannot.
Reproduce code:
---------------
$d = new DateTime("-4000-01-31"); echo $d->format("Y-m-d"), PHP_EOL;
$d = date_create_from_format("Y-m-d", "4000-01-31"); echo
$d->format("Y-m-d"), PHP_EOL;
$d = date_create_from_format("Y-m-d", "-4000-01-31"); echo
$d->format("Y-m-d"), PHP_EOL;
Expected result:
----------------
-4000-01-31
4000-01-31
-4000-01-31
Actual result:
--------------
-4000-01-31
4000-01-31
PHP Fatal error: Call to a member function format() on a non-object in
Command line code on line 3
--
Edit bug report at http://bugs.php.net/?id=45509&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45509&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45509&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45509&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45509&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45509&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45509&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45509&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45509&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45509&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45509&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45509&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45509&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45509&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45509&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45509&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45509&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45509&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45509&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45509&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45509&r=mysqlcfg