php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69184 CLI-only MSSQL crash
Submitted: 2015-03-04 16:10 UTC Modified: 2016-01-15 19:59 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: victor_volpe at bol dot com dot br Assigned:
Status: Closed Package: MSSQL related
PHP Version: 5.6.17 OS: FreeBSD 10.1-RELEASE-p6
Private report: No CVE-ID: None
 [2015-03-04 16:10 UTC] victor_volpe at bol dot com dot br
Description:
------------
Hi, I'm using FreeTDS 0.91.103_2,1 and the this script are running fine in webserver but not in CLI. Maybe PHP are passing invalid pointers to the dbopen() function of FreeTDS. I have several crontab jobs that requires MSSQL connection so I need this bug fixed ASAP.

Ps.: No output in the FreeTDS debug file and the tsql (FreeTDS CLI) are running fine too.

Thanks.

Test script:
---------------
<?php
if (mssql_connect("100.100.100.100", "sa", "thisissparta"))
        print "Connection success\n";
else
        print "Connection error\n";
?>

Actual result:
--------------
(gdb) run test.php
Starting program: /usr/bin/php test.php
[New LWP 100886]
[New Thread 808c06400 (LWP 100886/php)]

Program received signal SIGBUS, Bus error.
[Switching to Thread 808c06400 (LWP 100886/php)]
0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
(gdb) bt
#0  0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5
#1  0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5
#2  0x000000080635a1c1 in getpwent () from /lib/libc.so.7
#3  0x00000008063591b0 in getpwent_r () from /lib/libc.so.7
#4  0x000000080636ce2f in nsdispatch () from /lib/libc.so.7
#5  0x0000000806359c1e in getpwuid_r () from /lib/libc.so.7
#6  0x0000000801cd1978 in dbopen () from /usr/local/lib/libsybdb.so.5
#7  0x0000000801cc4cfd in dbopen () from /usr/local/lib/libsybdb.so.5
#8  0x0000000801cc3f85 in dbopen () from /usr/local/lib/libsybdb.so.5
#9  0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5
#10 0x00000000006c77df in php_mssql_do_connect () at php_mssql.c:793
#11 0x00000000008ca887 in zend_do_fcall_common_helper_SPEC (execute_data=0x808c42100) at zend_vm_execute.h:558
#12 0x0000000000889bf8 in execute_ex (execute_data=<value optimized out>) at zend_vm_execute.h:363
#13 0x0000000000860da0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:1341
#14 0x0000000000804f8c in php_execute_script (primary_file=0x7fffffffe868) at main.c:2578
#15 0x00000000008e6ccc in do_cli (argc=<value optimized out>, argv=<value optimized out>) at php_cli.c:994
#16 0x00000000008e59ba in main (argc=<value optimized out>, argv=<value optimized out>) at php_cli.c:1378

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-15 16:18 UTC] erik5 at pair dot com
I was able to resolve this by recompiling FreeTDS from source without --enable-sybase-compat.
 [2016-01-15 19:59 UTC] victor_volpe at bol dot com dot br
-Status: Open +Status: Closed -PHP Version: 5.6.6 +PHP Version: 5.6.17
 [2016-01-15 19:59 UTC] victor_volpe at bol dot com dot br
Solved. Thanks to erik5!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC