From: Operating system: Red Hat Linux 5.5,64-bit PHP version: 5.2.17 Package: ODBC related Bug Type: Bug Bug description:Segmentation fault while executing queries with just one column
Description: ------------ When the select statement includes only one column, the script crashes with "zend_mm_heap corrupted" or segmentation fault errors. When we add a dummy column to the select statement, the script runs successfully. Looks like some data structure initialization bug. For example, select name0 from COMPANY where name0 like 'A%'; -- errors out select name0,1 from COMPANY where name0 like 'A%'; -- runs successfully Test script: --------------- <?php $db_conn = odbc_connect('NZSQL','<username>','<password>') or alert("Could not connect: " . odbc_error()); echo "Connected successfully!\n"; $query="select name0 from COMPANY where name0 like 'A%' "; echo "executing ...\n"; $result = odbc_exec($db_conn,$query); echo "executed query ...\n"; if (!$result) alert("Could not run query: " . odbc_error()); echo "fetching resultset ...\n"; while(odbc_fetch_array($result)) { $row0 = odbc_result($result, 1); echo "field1:$row0\n"; } odbc_close($db_conn); echo "Completed successfully\n"; function alert($errMsg) { fwrite(STDERR, "$errMsg\n"); exit(2); } ?> Expected result: ---------------- Connected successfully! executing ... executed query ... fetching resultset ... field1:<company names> .... Completed successfully Actual result: -------------- Connected successfully! executing ... zend_mm_heap corrupted -- Edit bug report at http://bugs.php.net/bug.php?id=54986&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54986&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54986&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54986&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54986&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54986&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54986&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54986&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54986&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54986&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54986&r=support Expected behavior: http://bugs.php.net/fix.php?id=54986&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54986&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54986&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54986&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54986&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54986&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54986&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54986&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54986&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54986&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54986&r=mysqlcfg