#42070 [NEW]: Using combined operators on unset values in object's array causes crash

From: Date: Sun, 22 Jul 2007 16:30:48 +0000
Subject: #42070 [NEW]: Using combined operators on unset values in object's array causes crash
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115307@lists.php.net to get a copy of this message
From:             michiel at worthit dot nl
Operating system: Windows Vista Business
PHP version:      5.2.3
PHP Bug Type:     Reproducible crash
Bug description:  Using combined operators on unset values in object's array causes crash

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.

-- 
Edit bug report at http://bugs.php.net/?id=42070&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42070&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42070&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42070&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42070&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=42070&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42070&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42070&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42070&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42070&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42070&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=42070&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=42070&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42070&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42070&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42070&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42070&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42070&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42070&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42070&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42070&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#115307) next »