Bug #73725 [Opn->Fbk]: Unable to retrieve value of varchar(max) type

From: Date: Mon, 12 Dec 2016 21:45:37 +0000
Subject: Bug #73725 [Opn->Fbk]: Unable to retrieve value of varchar(max) type
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205942@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73725&edit=1 ID: 73725 Updated by: ab@php.net Reported by: honza dot hink at gmail dot com Summary: Unable to retrieve value of varchar(max) type -Status: Open +Status: Feedback Type: Bug Package: ODBC related Operating System: Windows 10 PHP Version: 7.1.0 Block user comment: N Private report: N New Comment: Thanks for the report. For completeness, could you please also post an ODBC trace? Thanks. Previous Comments: ------------------------------------------------------------------------ [2016-12-12 16:10:31] honza dot hink at gmail dot com Related to MS SQL - all versions from 2005 to 2014 ------------------------------------------------------------------------ [2016-12-12 16:06:45] honza dot hink at gmail dot com Description: ------------ If result set contains a column type varchar(max) then all functions (odbc_fetch_array, odbc_fetch_row etc.) return some random bytes. It looks like buffer overrun. If you change declaration varchar(max) to varchar(200) then it will work. Very old bug, I hopped it will be finally fixed in PHP 7, but wainly. Test script: --------------- <?php $con=odbc_connect("Local64bit","you","yourPWD"); $res=odbc_do($con,"set nocount on create table #t(i int, txt varchar(max)) insert into #t values(101,'Any text') select i,txt from #t "); $r=odbc_fetch_array($res); print_r($r); ?> Expected result: ---------------- Array ( [i] => 101 [txt] => Any text ) Actual result: -------------- Array ( [i] => 101 [txt] => €k ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73725&edit=1

« previous php.bugs (#205942) next »