From:             eric dot daspet at survol dot net
Operating system: MS Windows XP
PHP version:      5.1.4
PHP Bug Type:     SPL related
Bug description:  first call to unset() fails with ArrayObjet on a 
multidimensionnal superglobal

Description:
------------
When a multidimentional superglobal is used to feed ArrayObjet, the first
unset of a sub-index is ignored.

- it is ok with a "normal" array, I've seen this only with $_REQUEST and
$_GET

- it is ok with $_GET as a simple array (one dimension)

- the second call to unset() succeed, either if is the exact same call or
if I try to unset another index, only the first fails

Reproduce code:
---------------
<?php

// call the script with ?index[i]=1&index[j]=2

$ao = new ArrayObject( $_GET ) ;

unset( $ao['index']['i'] ) ;  // ignored
var_dump($ao) ;

unset( $ao['index']['j'] ) ; // ok
var_dump($ao) ;

unset( $ao['index']['i'] ) ; // ok
var_dump($ao) ;

Expected result:
----------------
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(2) {
         ["i"]=>  string(1) "1"
         ["j"]=>  string(1) "2" 
    }
}
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(1) {
         ["i"]=>  string(1) "1"
    }
}
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(0) {
    }
}

Actual result:
--------------
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(1) {
         ["j"]=>  string(1) "1"
    }
}
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(0) {
    }
}
object(ArrayObject)#1 (1) { 
    ["index"]=>  array(0) {
    }
}

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

Reply via email to