|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54986 Segmentation fault while executing queries with just one column
Submitted: 2011-06-03 16:49 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: chandra dot madathil at theice dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.2.17 OS: Red Hat Linux 5.5,64-bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
38 + 31 = ?
Subscribe to this entry?

 [2011-06-03 16:49 UTC] chandra dot madathil at theice dot com
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:
$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";
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-06 17:15 UTC] chandra dot madathil at theice dot com
Looks like this error is more widespread than I thought of initially. I am getting this error while freeing the resultset for some other programs too.

Were you able to reproduce this issue? Our production server migration is delayed due to this issue.
 [2011-06-11 04:04 UTC]
-Status: Open +Status: Feedback
 [2011-06-11 04:04 UTC]
Can you run the test on cli using valgrind? If yes, please post the valgrind log.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 04:03:39 2023 UTC