#28574 [Opn->Csd]: PHP crashes with a foreach.
| From: | iliaa@php.net | Date: | Sun, 30 May 2004 17:46:23 +0000 |
| Subject: | #28574 [Opn->Csd]: PHP crashes with a foreach. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60157@lists.php.net to get a copy of this message | ||
ID: 28574
Updated by: iliaa@php.net
Reported By: webroom at quicknet dot nl
-Status: Open
+Status: Closed
Bug Type: Reproducible crash
Operating System: Windows
PHP Version: 4.3.5
New Comment:
Does not happen with latest CVS, a correct warning:
Invalid argument supplied for foreach() is being displayed.
Previous Comments:
------------------------------------------------------------------------
[2004-05-30 12:38:43] webroom at quicknet dot nl
Description:
------------
Hi,
When I recently with my project used a foreach with a string,
consequently not with an array, apache spontaneously crashed. An
example could be found by reproduce code.
I use:
Apache 2.0.44
PHP 4.3.5 (yep, sorry, not the newest one...)
Windows XP Proffesional SP1 English
PHP is installed as an Apache module. (not CGI)
Reproduce code:
---------------
<?php
// P.S. The code that I used in my project was to big, and I don't have
a server to place it. So I use an example.
$string = "Line 1 of the string
This is line 2 so as you can see.
And also line 3.";
foreach ($string AS $key => $line) {
// Do some actions..
}
?>
Expected result:
----------------
Well, is should expect an array from PHP with: Can only use arrays in
foreach loops or something.
Actual result:
--------------
Apache crashed as I already said.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28574&edit=1