php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28574 PHP crashes with a foreach.
Submitted: 2004-05-30 12:38 UTC Modified: 2004-05-30 19:46 UTC
From: webroom at quicknet dot nl Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 4.3.5 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webroom at quicknet dot nl
New email:
PHP Version: OS:

 

 [2004-05-30 12:38 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-30 19:46 UTC] iliaa@php.net
Does not happen with latest CVS, a correct warning:  
Invalid argument supplied for foreach() is being displayed. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Sep 07 08:00:02 2025 UTC