php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28938 foreach statement can be forced to crash PHP
Submitted: 2004-06-28 09:25 UTC Modified: 2005-02-23 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: tomas_matousek at hotmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.0.0RC3 OS: WinXP
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: tomas_matousek at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-06-28 09:25 UTC] tomas_matousek at hotmail dot com
Description:
------------
The following code crashes PHP.

Reproduce code:
---------------
$a = array(0,1,2);
foreach ($a as $value)
{
  $a->foo = "bar";
}

Expected result:
----------------
none

Actual result:
--------------
crash

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-30 07:10 UTC] curt@php.net
here is some output in debug mode:
$a = array(0,1);
foreach ($a as $value)
{
  $a->foo = "bar";
}


PHP Warning:  Attempt to assign property of non-object in /php/bugs/28938.php on line 6
PHP Warning:  Attempt to assign property of non-object in /php/bugs/28938.php on line 6
[Wed Jun 30 05:09:40 2004]  Script:  '28938.php'
---------------------------------------
/php/php-src/Zend/zend_execute.c(76) : Block 0x0840AAEC status:
/cvs/php/php-src/Zend/zend_execute.h(61) : Actual location (location was relayed)
Beginning:      Overrun (magic=0x00000006, expected=0x7312F8DC)
      End:      Unknown
---------------------------------------
PHP Warning:  String is not zero-terminated (ZZZZ...)
        (source: /cvs/php/php-src/Zend/zend_opcode.c:215) in Unknown on line 0
[Wed Jun 30 05:09:40 2004]  Script:  '28938.php'
---------------------------------------
/cvs/php/php-src/Zend/zend_opcode.c(215) : Block 0x0840BD18 status:
/cvs/php/php-src/Zend/zend_variables.c(45) : Actual location (location was relayed)
Beginning:      Cached (allocated on /cvs/php/php-src/Zend/zend_language_scanner.l:1510, 4 bytes)
      End:      OK
---------------------------------------

 [2004-07-13 18:13 UTC] fixxxer at php5 dot ru
Reproduced on WinXP, latest snap. Could not reproduce on FreeBSD. Seems to be win32 specific
 [2005-02-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 13:01:28 2025 UTC