#45403 [Opn->Bgs]: Script causes infinite loop
ID: 45403
Updated by: jani@php.net
Reported By: glaesser at whsoft dot de
-Status: Open
+Status: Bogus
Bug Type: Reproducible crash
Operating System: Debian4, php 5.2.0-8+etch11
PHP Version: 5.2CVS-2008-07-02
New Comment:
It's actually just bad code. You're not considering that there's the
DST change happening on 2008-10-26. (Last sunday on october in 2008).
Previous Comments:
------------------------------------------------------------------------
[2008-07-02 10:10:16] glaesser at whsoft dot de
Tested on
Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g
mod_autoindex_color PHP/5.2.7-dev configured -- resuming normal
operations
Same problem:
Script timeout | Unable to allocate enough memory
------------------------------------------------------------------------
[2008-07-02 09:15:37] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2008-07-01 14:42:03] glaesser at whsoft dot de
Description:
------------
Following script works perfect on PHP 5.0.5-Debian-0.8~sarge1 but it
produces infinite loops on PHP 5.1.2 or PHP 5.2.0-8+etch11.
Reproduce code:
---------------
$testArray = array();
$testArray[] = array('ueberdat' => '2008-04-01', 'rueckdat' =>
'2008-04-06');
$testArray[] = array('ueberdat' => '2008-04-12', 'rueckdat' =>
'2008-04-26');
$testArray[] = array('ueberdat' => '2008-04-26', 'rueckdat' =>
'2008-05-03');
$testArray[] = array('ueberdat' => '2008-05-10', 'rueckdat' =>
'2008-05-20');
$testArray[] = array('ueberdat' => '2008-05-24', 'rueckdat' =>
'2008-06-07');
$testArray[] = array('ueberdat' => '2008-06-14', 'rueckdat' =>
'2008-06-21');
$testArray[] = array('ueberdat' => '2008-06-21', 'rueckdat' =>
'2008-06-28');
$testArray[] = array('ueberdat' => '2008-06-28', 'rueckdat' =>
'2008-07-05');
$testArray[] = array('ueberdat' => '2008-07-05', 'rueckdat' =>
'2008-07-12');
$testArray[] = array('ueberdat' => '2008-07-19', 'rueckdat' =>
'2008-07-26');
$testArray[] = array('ueberdat' => '2008-07-26', 'rueckdat' =>
'2008-08-02');
$testArray[] = array('ueberdat' => '2008-08-02', 'rueckdat' =>
'2008-08-16');
$testArray[] = array('ueberdat' => '2008-08-23', 'rueckdat' =>
'2008-09-06');
$testArray[] = array('ueberdat' => '2008-09-13', 'rueckdat' =>
'2008-09-20');
$testArray[] = array('ueberdat' => '2008-09-27', 'rueckdat' =>
'2008-10-04');
$testArray[] = array('ueberdat' => '2008-10-11', 'rueckdat' =>
'2008-10-15');
$testArray[] = array('ueberdat' => '2008-10-25', 'rueckdat' =>
'2008-11-02');
$arrRet = array();
foreach ($testArray as $testValue) {
$startDat = $testValue['ueberdat'];
while ($startDat < $testValue['rueckdat']) {
$arrRet[] = array('belDat' => $startDat);
$startDat = date("Y-m-d", strtotime($startDat)+86400);
}
}
print_r($arrRet);
Expected result:
----------------
I want all days from the given dates like...
Array
(
[0] => Array
(
[belDat] => 2008-04-01
)
[1] => Array
(
[belDat] => 2008-04-02
)
[2] => Array
(
[belDat] => 2008-04-03
)
[3] => Array
(
[belDat] => 2008-04-04
)
[4] => Array
(
[belDat] => 2008-04-05
)
[5] => Array
(
[belDat] => 2008-04-12
)
[6] => Array
(
[belDat] => 2008-04-13
)
[7] => Array
(
[belDat] => 2008-04-14
)
[8] => Array
(
[belDat] => 2008-04-15
)
... and so on
Actual result:
--------------
Script timeout on new PHP-Version.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45403&edit=1
Thread (5 messages)