php.net |  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
Votes:3
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chandra dot madathil at theice dot com
New email:
PHP Version: OS:

 

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

Patches

Pull Requests

History

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] felipe@php.net
-Status: Open +Status: Feedback
 [2011-06-11 04:04 UTC] felipe@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC