|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-24 12:01 UTC] jani@php.net
[2007-07-24 14:25 UTC] macuyiko at gmail dot com
[2009-11-08 16:09 UTC] felipe@php.net
[2009-11-16 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Description: ------------ Using Intersystems' Cache 64 bit ODBC driver (libcacheodbc.so) with unixODBC causes PHP 5.2.3 to crash. (I never had a problem with the 32 bit driver.) Also, using another ODBC tool, like isql, works fine. I have managed to track down this problem in PHP's source code, in php_odbc.c, in the function PHP_FUNCTION(odbc_free_result), there are the following lines: //...start fragment... ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); if (result->values) { for (i = 0; i < result->numcols; i++) { if (result->values[i].value) { efree(result->values[i].value); } } efree(result->values); result->values = NULL; } //...end fragment... Commenting out the line: efree(result->values); causes PHP to Segfault. Commenting out the line: efree(result->values[i].value); still gives the zend_mm_heap corrupted error. When I comment out both lines, the problem disappears. But I fear that this might not be good practice. So what could be causing this problem? It is only with the 64 bit driver/PHP/Linux that this error occurs. Using the 32 bit driver works. Other databases' ODBC drivers work fine too. Note: this error was also present in PHP 5.2.1. In PHP 5.1.6, I got a "glibc double free detected"-error. Reproduce code: --------------- <?php echo "Opening connection...\n"; $connection = odbc_connect($dsn,"",""); //connect to dsn echo "Executing SQL...\n"; $result = odbc_do($connection,$sqlstring); //optional code to do something with resultset here /*the following line crashes PHP with zend_mm_heap corrupted commenting out this line doesn't help (since the result will be freed automatically anyway*/ echo "Freeing...\n"; odbc_free_result($result); echo "Closing...\n"; odbc_close($connection); echo "Done.\n"; ?> Expected result: ---------------- Opening connection... Executing SQL... Freeing... Closing... Done. Actual result: -------------- Opening connection... Executing SQL... Freeing... zend_mm_heap corrupted