Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.0dev1

Bug #9914 Incorrect array index assumption
Submitted: 2007-01-22 15:12 UTC
From: rjbarbour at gmail dot com Assigned: wiesemann
Status: Closed Package: Structures_DataGrid_DataSource_Array (version 0.1.1)
PHP Version: 5.0.5 OS: XP SP2
Roadmaps: (Not assigned)    
Subscription  


 [2007-01-22 15:12 UTC] rjbarbour at gmail dot com (Rob)
Description: ------------ The array $_ar may have integer indexes. The script assume, on line 120 of Array.php, that the first element of the array will be at $_ar[0]. This can be an incorrect assumption. See example below. Test script: --------------- $my_array = array( 5 => 'five', 3 => 'three' ); $datagrid->bind($my_array); //$this->_ar[0] on line 120 of Array.php will evaluate to NULL Expected result: ---------------- No warning. Actual result: -------------- Warning: array_keys() [function.array-keys]: The first argument should be an array in C:\<my_path>\PEAR\pear\Structures\DataGrid\DataSource\Array.php on line 120

Comments

 [2007-01-22 15:13 UTC] rjbarbour at gmail dot com
changed my email address
 [2007-01-23 17:47 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-01-23 22:23 UTC] rjbarbour at gmail dot com
Access to key 0 may be invalid if the first element of the shiny new array is unset: eg: $my_array = array( array( 'name' => 'Alice', 'address' => 'foo' ), array( 'name' => 'Bob', 'address' => 'bar') array( 'name' => 'Charlie', 'address' => 'quxx') ); unset($my_array['0']); /* Array now looks like this: array( 1 => array( 'name' => 'Bob', 'address' => 'bar') 2 => array( 'name' => 'Charlie', 'address' => 'quxx') ) */ $datagrid->bind($my_array); If $my_array is re-indexed with array_merge() then Array.php will not complain. I don't think it should be necessary to do this.
 [2007-01-24 11:07 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-01-24 19:57 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!