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

Bug #19737 fetchrow with MDB2_FETCHMODE_OBJECT
Submitted: 2012-12-09 14:16 UTC
From: ghada Assigned:
Status: Open Package: MDB2_Driver_sqlsrv (version 1.5.0b5)
PHP Version: 5.3.8 OS: Windows 7
Roadmaps: (Not assigned)    
Subscription  


 [2012-12-09 14:16 UTC] ghada (ghada el)
Description: ------------ Get the following error when fetching a row with MDB2_FETCHMODE_OBJECT: Fatal error: Cannot use object of type stdClass as array in C:\xampp\php\PEAR\MDB2.php on line 1828 This error was worked around using code below: Line 1824: case MDB2_PORTABILITY_RTRIM: foreach ($row as $key => $value) { if (is_string($value)) { $row[$key] = rtrim($value); } } break; Should be: case MDB2_PORTABILITY_RTRIM: foreach ($row as $key => $value) { if (is_string($value)) { if (is_array($row)) { $row[$key] = rtrim($value); } else { rtrim($row->$key); } } } break; Other issues still exist in MDB2 - with inserts. Not sure if related. Test script: --------------- $sql = "SELECT col1, col2 FROM T1"; $result = $dbConn->query($sql); if (MDB2::isError($result)) { die("error"); } $row =& $result->fetchRow(MDB2_FETCHMODE_OBJECT); // generates error. Expected result: ---------------- no errors. Actual result: -------------- Fatal error: Cannot use object of type stdClass as array in C:\xampp\php\PEAR\MDB2.php on line 1828

Comments