ID: 33478 Updated by: [EMAIL PROTECTED] Reported By: qjahe at videotron dot ca -Status: Open +Status: Wont fix Bug Type: Arrays related -Operating System: Linux Debian... +Operating System: * -PHP Version: 5.0.3 +PHP Version: 5.* New Comment:
Starting with PHP 5.1 we ensure correct signatures that is you are no longer able to use have offsetGet return by reference. Previous Comments: ------------------------------------------------------------------------ [2005-06-26 04:29:43] qjahe at videotron dot ca Description: ------------ Object implements ArrayAccess. First to make multi-dimension arrays i've been told there was a bug and I had to put by reference &offsetGet($offset) for that function. After that my multi-dimension arrays were working. Secondly it appears to ALWAYS, whatever I tried, to return a E_NOTICE when the second index of the array doesnt exists but the first one do exists. [index3 example] Thirdly when the second index doesnt exists and you are trying to fetch the third thru the second index and first index exists it seems to be returning the first lettre from the value of the last existing index...[index4 example] How can I check the second, third, fourth, etc... array index when all I get is $offset as a string or only one parameter... Reproduce code: --------------- <?php ini_set("display_errors", "On"); error_reporting(E_ALL); class Data{ public static $myArray = array(); final function __construct(){} final function __destruct(){} final function __clone(){} } class test implements ArrayAccess{ function offsetExists($index){ if (isset(Data::$myArray[$index])) return TRUE; return FALSE; } function &offsetGet($index){ if (isset(Data::$myArray[$index])) return Data::$myArray[$index]; $index = FALSE; return $index; } function offsetSet($index, $value){ Data::$myArray[$index] = $value; } function offsetUnset($index){ Data::$myArray[$index] = NULL; } } $test = new test(); $test['index1'] = array(); $test['index1']['test1'] = 'test2'; $test['index1']['index2'] = 'xest3'; $test['test4'] = 'test5'; echo $test['test4']; echo $test['index1']['index3']; echo $test['index1']['index2']['index4']; echo $test['index5']; ?> Expected result: ---------------- test5 Actual result: -------------- test5 Notice: Undefined index: index3 in /path/file.php on line 36 x ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33478&edit=1