[PHP-BUG] Bug #71171 [NEW]: odbc_fetch_array generates SIGFAULT
[email protected] ("sergiopaternoster73 at gmail dot com")
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
From: sergiopaternoster73 at gmail dot com
Operating system: Linux Ubuntu 14.03
PHP version: 7.0.1
Package: ODBC related
Bug Type: Bug
Bug description:odbc_fetch_array generates SIGFAULT
Description:
------------
When the query returns a non UTF-8 character, odbc_fetch_array generates
SIGFAULT
If the record contains normal UTF-8 (for example Chinese characters) it
works fine. The SQL Server field containing non UTF-8 chars has been
defined as NVARCHAR(40)
Test script:
---------------
$dbConn = odbc_connect("Driver={ODBC Driver 11 for SQL
Server};Server=myserver.domain.com", 'MyUSER', 'MyPWD');
$query = "SELECT [TXTMD] FROM [/BI0/TMATERIAL] WHERE [LANGU] = 'E' AND
[MATERIAL] = 'T_PO1234568'";
$r = odbc_exec($dbConn,$query);
while($record = odbc_fetch_array($r) ) print_r($record);
odbc_close($dbConn);
Expected result:
----------------
If I run it with WHERE [LANGU] = '1' I get UTF-8 chars
Array
(
[TXTMD] =>
JLGLQ-0.45-100£¬¹ýÂËÆ÷,ˮϵPES,0.45um,100/°ü
)
with WHERE [LANGU] = 'E' I get segfault. The actual records contains non
UTF-8 chars
Actual result:
--------------
edsradmin@SHALSTest:~/apps.cndb/scripts/cndb$ gdb
/usr/local/php/7.0.1/bin/php core
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/php/7.0.1/bin/php...done.
[New LWP 16450]
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php -q ./tmp/odbc_sqlsrv.php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 __memcpy_sse2_unaligned () at
../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:116
116 ../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S: No such
file or directory.
Traceback (most recent call last):
File
"/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py",
line 63, in <module>
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
(gdb) bt
#0 __memcpy_sse2_unaligned () at
../sysdeps/x86_64/multiarch/memcpy-sse2-unaligned.S:116
#1 0x00000000006ecfeb in zend_string_init (str=0x7f6e2ba76080 "",
len=18446744073709551612, persistent=0)
at /home/edsradmin/software/php-7.0.1/Zend/zend_string.h:159
#2 0x00000000006f16ec in php_odbc_fetch_hash
(execute_data=0x7f6e2ba14120, return_value=0x7f6e2ba14110,
result_type=2)
at /home/edsradmin/software/php-7.0.1/ext/odbc/php_odbc.c:1812
#3 0x00000000006f18d8 in zif_odbc_fetch_array
(execute_data=0x7f6e2ba14120, return_value=0x7f6e2ba14110)
at /home/edsradmin/software/php-7.0.1/ext/odbc/php_odbc.c:1848
#4 0x0000000000a32ed8 in ZEND_DO_ICALL_SPEC_HANDLER () at
/home/edsradmin/software/php-7.0.1/Zend/zend_vm_execute.h:586
#5 0x0000000000a32913 in execute_ex (ex=0x7f6e2ba14030) at
/home/edsradmin/software/php-7.0.1/Zend/zend_vm_execute.h:414
#6 0x0000000000a32a25 in zend_execute (op_array=0x7f6e2ba83000,
return_value=0x0) at
/home/edsradmin/software/php-7.0.1/Zend/zend_vm_execute.h:458
#7 0x00000000009d7c8b in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/edsradmin/software/php-7.0.1/Zend/zend.c:1428
#8 0x00000000009451e8 in php_execute_script
(primary_file=0x7ffc7fc3fec0) at
/home/edsradmin/software/php-7.0.1/main/main.c:2471
#9 0x0000000000a96c73 in do_cli (argc=3, argv=0x2b821c0) at
/home/edsradmin/software/php-7.0.1/sapi/cli/php_cli.c:974
#10 0x0000000000a97e37 in main (argc=3, argv=0x2b821c0) at
/home/edsradmin/software/php-7.0.1/sapi/cli/php_cli.c:1345
--
Edit bug report at https://bugs.php.net/bug.php?id=71171&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71171&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71171&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71171&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71171&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71171&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71171&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71171&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71171&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71171&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71171&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71171&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71171&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71171&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71171&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71171&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71171&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71171&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71171&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71171&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71171&r=mysqlcfg