php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64483 ODBC: PDO fetch method causes server reset
Submitted: 2013-03-21 19:30 UTC Modified: 2020-10-11 04:22 UTC
Votes:12
Avg. Score:4.5 ± 0.8
Reproduced:10 of 10 (100.0%)
Same Version:3 (30.0%)
Same OS:3 (30.0%)
From: shrimpwagon at yahoo dot com Assigned: cmb (profile)
Status: No Feedback Package: PDO ODBC
PHP Version: 5.4.13 OS: Linux 3.2.0-4-686-pae
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shrimpwagon at yahoo dot com
New email:
PHP Version: OS:

 

 [2013-03-21 19:30 UTC] shrimpwagon at yahoo dot com
Description:
------------
I can connect fine. The PDOStatement::fetch method causes a web server connection reset when another method is called after the PDOStatement::execute method and before the PDOStatement::fetch. See test script.

- Linux version 3.2.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.35-2

- FreeTDS 0.91

- Apache/2.4.4 (Unix) OpenSSL/1.0.1c

- Connecting to a Microsoft SQL Server 2005 - 9.00.5000.00 (X64)


apt-get install freetds-common freetds-dev freetds-bin tdsodbc unixodbc-dev

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --enable-sockets --with-openssl --with-mysql --with-mcrypt --enable-mbstring --enable-bcmath --enable-calendar --with-curl --with-gd --with-bz2 --enable-exif --enable-ftp --with-gettext --with-mhash --with-mysqli --enable-soap --enable-wddx --enable-zip --with-pdo-mysql --with-pdo-odbc=unixODBC,/usr



Test script:
---------------
$db = new PDO('odbc:Driver=FreeTDS; Server=127.0.0.1; Port=1433; Database=mssqldb', 'mssqluser', 'mssqlpass');
$statement = $db->prepare('SELECT * FROM table');
$statement->execute();
$count = $statement->rowCount(); // Comment this line and it works fine. Even var_dump($statement) will cause the same problem.
$result = $statement->fetch(PDO::FETCH_NUM);

Expected result:
----------------
For fetch to not reset connection and return a proper result

Actual result:
--------------
Server reset.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-21 20:26 UTC] shrimpwagon at yahoo dot com
-: shawnhausser at yahoo dot com +: shrimpwagon at yahoo dot com
 [2013-03-21 20:26 UTC] shrimpwagon at yahoo dot com
"AH00052: child pid 5808 exit signal Segmentation fault (11)". Also getting "zend_mm_heap corrupted"

I'm not the only one having this issue: http://serverfault.com/questions/490061/pdo-odbc-error-just-resets-connection
 [2013-03-22 04:12 UTC] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

sorry, don't have a mssql server
 [2013-03-22 04:12 UTC] laruence@php.net
-Status: Open +Status: Feedback
 [2013-03-22 14:26 UTC] shrimpwagon at yahoo dot com
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7ddfc16 in kill () from /lib/i386-linux-gnu/i686/cmov/libc.so.6
#2  0xb5ec0d9c in zend_mm_panic (message=0xb6494e70 "zend_mm_heap corrupted") at /home/shawn/setup/php-5.4.13/Zend/zend_alloc.c:92
#3  0xb5ec204a in zend_mm_find_leaks (segment=0x88503f0, b=0x886edd0) at /home/shawn/setup/php-5.4.13/Zend/zend_alloc.c:1250
#4  0xb5ec21d5 in zend_mm_check_leaks (heap=0x81077e0) at /home/shawn/setup/php-5.4.13/Zend/zend_alloc.c:1304
#5  0xb5ec2d26 in zend_mm_shutdown (heap=0x81077e0, full_shutdown=0, silent=0) at /home/shawn/setup/php-5.4.13/Zend/zend_alloc.c:1668
#6  0xb5ec4e5c in shutdown_memory_manager (silent=0, full_shutdown=0) at /home/shawn/setup/php-5.4.13/Zend/zend_alloc.c:2664
#7  0xb5e794a5 in php_request_shutdown (dummy=0x0) at /home/shawn/setup/php-5.4.13/main/main.c:1819
#8  0xb6007a66 in php_apache_request_dtor (r=0xb6fb7bf8) at /home/shawn/setup/php-5.4.13/sapi/apache2handler/sapi_apache2.c:507
#9  0xb6008139 in php_handler (r=0xb6fb7bf8) at /home/shawn/setup/php-5.4.13/sapi/apache2handler/sapi_apache2.c:679
#10 0x08090d6a in ap_run_handler ()
#11 0x080914f3 in ap_invoke_handler ()
#12 0x080a9a91 in ap_internal_redirect ()
#13 0xb7a0d5f5 in handler_redirect () from /usr/local/apache2/modules/mod_rewrite.so
#14 0x08090d6a in ap_run_handler ()
#15 0x080914f3 in ap_invoke_handler ()
#16 0x080a8c87 in ap_process_async_request ()
#17 0x080a8d50 in ap_process_request ()
#18 0x080a54a8 in ap_process_http_sync_connection ()
#19 0x080a55b1 in ap_process_http_connection ()
#20 0x0809bebf in ap_run_process_connection ()
#21 0x0809c2f4 in ap_process_connection ()
#22 0x080b16f6 in child_main ()
#23 0x080b1809 in make_child ()
#24 0x080b1d8b in prefork_run ()
#25 0x08074b63 in ap_run_mpm ()
#26 0x0806e52a in main ()
 [2013-03-22 14:26 UTC] shrimpwagon at yahoo dot com
-Status: Feedback +Status: Open
 [2013-03-28 14:01 UTC] shrimpwagon at yahoo dot com
Anything? What's the status???
 [2013-06-12 04:46 UTC] ssufficool@php.net
I tried the current PHP5.4 branch and this seems to work. I get a row count of 
"-1" using the CLI.

Linux 3.9.0-3-generic #8-Ubuntu SMP Tue May 28 18:40:41 UTC 2013 x86_64 x86_64 
x86_64 GNU/Linux

FreeTDS 0.91-4
 [2013-06-12 04:47 UTC] ssufficool@php.net
-Summary: PDO fetch method causes server reset +Summary: DBLIB: PDO fetch method causes server reset
 [2014-01-01 12:33 UTC] felipe@php.net
-Package: PDO related +Package: PDO ODBC
 [2014-10-21 04:10 UTC] ssufficool@php.net
-Summary: DBLIB: PDO fetch method causes server reset +Summary: ODBC: PDO fetch method causes server reset
 [2020-09-28 14:02 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-09-28 14:02 UTC] cmb@php.net
Can anybody reproduce this with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2020-10-11 04:22 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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 24 18:01:28 2020 UTC