From: jennifer dot kimball at nrc dot ca
Operating system: Solaris 10
PHP version: 5.3.0
PHP Bug Type: Date/time related
Bug description: DateInterval:createDateFromString() silently fails
Description:
------------
Documentation of DateInterval:createDateFromString() does not state what
happens when the function fails. So far as I can tell, it seems to produce
an empty DateInterval object.
If an empty object is the expected behaviour then it should be documented.
And more importantly, there should be an easy way to test if the object is
empty.
Given that creating a DatePeriod using an empty DateInterval consumes all
the memory available to a session, it seems to me that allowing empty
DateIntervals is a design flaw.
Reproduce code:
---------------
---
>From manual page: dateinterval.createfromdatestring#Return Values
---
$i=DateInterval::createFromDateString('P1D');//expected to fail
$d1=date_create('2009-10-27');
$d2=date_create('2009-11-15');
$p=new DatePeriod($d1,$i,$d2); //PHP times out
Expected result:
----------------
expect error at line $i=DateInterval::createFromDateString('P1D')
Actual result:
--------------
Fatal error: Allowed memory size of 314572800 bytes exhausted (tried to
allocate 72 bytes)
--
Edit bug report at http://bugs.php.net/?id=50020&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50020&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50020&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50020&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50020&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50020&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50020&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50020&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50020&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50020&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50020&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50020&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50020&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50020&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50020&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50020&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50020&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50020&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50020&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50020&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50020&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50020&r=mysqlcfg