Edit report at https://bugs.php.net/bug.php?id=63258&edit=1
ID: 63258
Updated by: laruence@php.net
Reported by: paul dot visco at roswellpark dot org
Summary: seg fault with PDO and dblib using DBSETOPT(H->link,
DBQUOTEDIDENT, 1);
Status: Assigned
Type: Bug
Package: PDO related
Operating System: centos 5.8
PHP Version: 5.4.7
Assigned To: ssufficool
Block user comment: N
Private report: N
New Comment:
ssufficool, do you have time to look into this?
seems you intentionally change the "NULL" to "1" in https://github.com/php/php-
src/commit/36b8c4cb
thanks
Previous Comments:
------------------------------------------------------------------------
[2012-10-11 10:22:26] laruence@php.net
according to MSDN, the fix should be:
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c
index 77832f9..baf1dcc 100644
--- a/ext/pdo_dblib/dblib_driver.c
+++ b/ext/pdo_dblib/dblib_driver.c
@@ -315,7 +315,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval
*driver_options TSRMLS_
DBSETOPT(H->link, DBTEXTSIZE, "2147483647");
/* allow double quoted indentifiers */
- DBSETOPT(H->link, DBQUOTEDIDENT, 1);
+ DBSETOPT(H->link, DBQUOTEDIDENT, NULL);
see: http://msdn.microsoft.com/en-us/library/aa937147(v=sql.80).aspx
"
Note When you use DBQUOTEDIDENT, you must set param to NULL.
"
------------------------------------------------------------------------
[2012-10-10 22:25:17] paul dot visco at roswellpark dot org
Description:
------------
revision #300716 to php source for /ext/pdo_dblib/ which adds support for double quoted field values
causes segfault on our system. According to https://bugs.php.net/bug.php?id=47588 line 318 was
added to support quoted field names. If pdo_dblib is recompiled without line 318 it works fine, no
segfault. My patch is just commenting out the line, which is really not a solution but it allows us
to be able to use the driver again.
PHP: 5.4.7
SYSTEM: CentOS 5.8
TSQL:
Version: freetds v0.91
freetds.conf directory: /etc
MS db-lib source compatibility: yes
Sybase binary compatibility: yes
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: yes
Test script:
---------------
$db = new PDO('dblib:host=somehost.somesite.org;charset=UTF-8;','username',
'password');
Expected result:
----------------
Segmentation fault
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
0x00000036b68788e0 in strlen () from /lib64/libc.so.6
(gdb) bt
#0 0x00000036b68788e0 in strlen () from /lib64/libc.so.6
#1 0x00000036b6846e77 in vfprintf () from /lib64/libc.so.6
#2 0x00000036b68e74a7 in __vfprintf_chk () from /lib64/libc.so.6
#3 0x00002aaab1e6ece5 in ?? () from /usr/lib64/libsybdb.so.5
#4 0x00002aaab1e43dd8 in dbsetopt () from /usr/lib64/libsybdb.so.5
#5 0x00002aaab2e51447 in pdo_dblib_handle_factory (dbh=0x2aaaaab0c298, driver_options=<value
optimized out>)
at /home/visco/php-5.4.7/ext/pdo_dblib_orig/dblib_driver.c:318
#6 0x00002aaab2c40099 in zim_PDO_dbh_constructor (ht=<value optimized out>,
return_value=<value optimized out>,
return_value_ptr=<value optimized out>, this_ptr=0x2aaaaab0a8f0,
return_value_used=<value optimized out>)
at /home/visco/php-5.4.7/ext/pdo/pdo_dbh.c:380
#7 0x00002aaaae23df42 in xdebug_execute_internal (current_execute_data=0x2aaaaaad5060,
return_value_used=0)
at /tmp/tmpBeyREt/xdebug-2.2.1/xdebug.c:1483
#8 0x00000000006008e7 in ?? ()
#9 0x000000000060680e in execute ()
#10 0x00002aaaae24061f in xdebug_execute (op_array=0x2aaaaab0b160) at
/tmp/tmpBeyREt/xdebug-2.2.1/xdebug.c:1391
#11 0x00000000005d1dbe in zend_execute_scripts ()
#12 0x00000000005770d8 in php_execute_script ()
#13 0x00000000006789cd in ?? ()
#14 0x000000000067934d in ?? ()
#15 0x00000036b681d994 in __libc_start_main () from /lib64/libc.so.6
#16 0x00000000004239c9 in _start ()
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63258&edit=1