PHP 4.0 Bug #7412 Updated: assigning references from parts of array

From: Date: Mon, 30 Oct 2000 14:41:16 +0000
Subject: PHP 4.0 Bug #7412 Updated: assigning references from parts of array
Groups: php.dev 
Request: Send a blank email to php-dev+get-36397@lists.php.net to get a copy of this message
ID: 7412 Updated by: stas Reported By: panu.kalliokoski@giro.fi Status: Closed Bug Type: *General Issues Assigned To: Comments: I see no bug here. Please read the "references explained" part in the manual. As for serializing references - patch is under way. Expect it in next PHP version or in CVS in coming days. Previous Comments: --------------------------------------------------------------------------- [2000-10-23 11:54:23] panu.kalliokoski@giro.fi This is a problem where two features which I deem misfeatures together cause a greater problem. The first misfeature is that, if I understand correctly, php destroys _every_ reference-style variable when serialising them for session. Even turning them to normal and nice values would be better than nothing - tracking serialised variables is not that hard, is it? The first misfeature would not cause much harm if I could evade using references altogether. However, in certain situations this is not the case. For example, if I have a deeply nested array from which I have to find a cell, based on some data (and the level of nesting may vary) and then assign a value to that cell, I have no choice but to use references because the $$ syntax does not work for arrays. You'd think that only passing existing values as references would leave them as values. But here comes the second misfeature. A clause such as $arr = array( 'argh' ); $ref =& $arr[0]; actually turns $arr[0] into a reference. There exists a workaround to this, which suggests that the misfeature could perhaps be corrected. It turns out that if I pass $arr[0] as a reference to a _function_ or _method_, it doesn't turn $arr[0] into a reference. So if I rewrite the loop that I use to dig into the array into a recursive function, I can have my arrays not destroyed when serialised. Even so, these two features are very irritating. Could they perhaps be corrected? --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7412

« previous php.dev (#36397) next »