Structures_DataGrid and arrays

From: Date: Mon, 25 Jul 2005 20:39:21 +0000
Subject: Structures_DataGrid and arrays
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20130@lists.php.net to get a copy of this message
Hello, I have an array that looks more or less like this: Array ( [14] => Array ( [technology] => 14 ) [5] => Array ( [technology] => 5 [count] => 0 ) [1] => Array ( [technology] => 1 [version] => 8 ) ) that I am passing to Structures_DataGrid::bind(). This array is stored on $_SESSION['searchQuery'] and my problem is that it is being modified by Structures_DataGrid. After I call Structures_DataGrid::sortRecordSet(), $_SESSION['searchQuery'] contains: Array ( [0] => Array ( [technology] => 14 ) [1] => Array ( [technology] => 1 [version] => 8 ) [2] => Array ( [technology] => 5 [count] => 0 ) ) Hew is this possible, I didn't pass by $_SESSION['searchQuery'] reference, shouldn't it be working on a copy ? So I decided to make the copy myself: $a = $_SESSION['searchQuery']; $queryTable->bind($a); and it is still being modified, how is that possible ? Just to test I added this: $a[] = array('technology' => '9'); and it seems that broke the conection between the two arrays and it is no longer being modified. According to http://www.php.net/manual/en/language.types.array.php $a should be a deep/recursive copy of $_SESSION['searchQuery']. So, I decided to work sorting all together only to find another problem: Warning: array_keys(): The first argument should be an array in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 96 Warning: in_array(): Wrong datatype for second argument in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 141 Warning: in_array(): Wrong datatype for second argument in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 141 Warning: in_array(): Wrong datatype for second argument in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 141 Warning: in_array(): Wrong datatype for second argument in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 141 Warning: in_array(): Wrong datatype for second argument in /usr/lib/php/Structures/DataGrid/DataSource/Array.php on line 141 It seem Structures_DataGrid is not prepared to work with arrays that don't start at 0. Anyway, if someone can tell me how to solve this problem I'd appretiate it a lot. -- Pupeno <pupeno@pupeno.com> (http://pupeno.com) Reading ? Science Fiction ? http://sfreaders.com.ar

Attachment: [application/pgp-signature]
« previous php.pear.general (#20130) next »