php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42070 Using combined operators on unset values in object's array causes crash
Submitted: 2007-07-22 16:30 UTC Modified: 2007-07-23 10:37 UTC
From: michiel at worthit dot nl Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.2.3 OS: Windows Vista Business
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: michiel at worthit dot nl
New email:
PHP Version: OS:

 

 [2007-07-22 16:30 UTC] michiel at worthit dot nl
Description:
------------
Using a combined operator on an array within an object causes apache to crash. Assigning the object's property to a temporary variable ($someArray = $bar->someArray) and then working with $someArray works as a workaround. Also this doesn't only apply to just arrays, $foo->bar->value += 1; crashes apache as well. Furthermore, this behaviour is also witnessed under version 5.2.2 and could not be reproduced on Gentoo Linux 2.6.19.

Reproduce code:
---------------
// Uncomment any lines below to achieve the same result

// $bar = new stdClass();

// $bar->someArray = array();

$bar->someArray[0] +=  1;

Expected result:
----------------
$bar to be an object, with the property $someArray to be an array containing the int value 1 at index 0 :

object(stdClass)#1 (1) {
  ["someArray"]=>
  array(1) {
    [0]=>
    int(1)
  }
}

Actual result:
--------------
Apache crashes, independent of combined operator or index.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-23 10:09 UTC] michiel at worthit dot nl
Installed the latest from snaps this morning, works like a charm. Thanks for your quick reply.
 [2007-07-23 10:37 UTC] jani@php.net
As I suspected, another related bug was fixed and obviously this is the same. (can't remember the bug id now..)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC