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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 10:01:31 2024 UTC