Bug #54986 [Opn->Fbk]: Segmentation fault while executing queries with just one column

From: Date: Sat, 11 Jun 2011 02:04:05 +0000
Subject: Bug #54986 [Opn->Fbk]: Segmentation fault while executing queries with just one column
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161297@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54986&edit=1

 ID:                 54986
 Updated by:         felipe@php.net
 Reported by:        chandra dot madathil at theice dot com
 Summary:            Segmentation fault while executing queries with just
                     one column
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            ODBC related
 Operating System:   Red Hat Linux 5.5,64-bit
 PHP Version:        5.2.17
 Block user comment: N
 Private report:     N

 New Comment:

Can you run the test on cli using valgrind? If yes, please post the valgrind log.


Previous Comments:
------------------------------------------------------------------------
[2011-06-06 17:15:01] 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-03 16:49:21] 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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54986&edit=1


Thread (5 messages)

« previous php.bugs (#161297) next »