ID:               50020
 User updated by:  jennifer dot kimball at nrc dot ca
 Reported By:      jennifer dot kimball at nrc dot ca
-Status:           Feedback
+Status:           Open
 Bug Type:         Date/time related
 Operating System: Solaris 10
 PHP Version:      5.3.0
 New Comment:

The snapshot fixes the memory problem for me. But there is still no way
to easily tell if a DateInterval size is zero or if there were errors
creating the DateInterval.


Previous Comments:
------------------------------------------------------------------------

[2009-10-27 22:31:45] [email protected]

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Works just fine for me. 

------------------------------------------------------------------------

[2009-10-27 17:35:39] jennifer dot kimball at nrc dot ca

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 this bug report at http://bugs.php.net/?id=50020&edit=1

Reply via email to