Edit report at https://bugs.php.net/bug.php?id=73725&edit=1
ID: 73725
Comment by: c141483 at nwytg dot com
Reported by: honza dot hink at gmail dot com
Summary: Unable to retrieve value of varchar(max) type
Status: Closed
Type: Bug
Package: ODBC related
Operating System: Windows 10
PHP Version: 7.1.0
Block user comment: N
Private report: N
New Comment:
The problem is still relevant and not solved :(
In fact, the problem is solved only for the varhar(max)
If a varchar column has a fixed size (for example, varhar (20)) and it contains 20 characters of
text (completely filled), then the problem with buffer overflow and displaying random bytes again
gets out.
It is clear that STILL is allocated less memory than necessary.
Previous Comments:
------------------------------------------------------------------------
[2018-01-22 16:05:53] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2384ade53c9ddb45b56e803a8d8494737732b84b
Log: Fixed bug #73725 Unable to retrieve value of varchar(max) type
------------------------------------------------------------------------
[2018-01-19 11:57:07] honza dot hink at gmail dot com
I am afraid the problem will remain open for next decade too.
------------------------------------------------------------------------
[2018-01-19 11:43:26] Jan_Oonk at hotmail dot com
Had the same problem.
Simple to recreate:
make a table in Microsoft SQL Server Express (64-bit) v13.0.4001.0 NT x64
with a column varchar(max)
I used
Apache/2.4.18 (Win64)
PHP/7.0.3
PDO with {ODBC Driver 13 for SQL Server}
Do a simple select query on the column and echo it and you will notice the text will be garbled.
The solution was to use a fixed size varchar column for example varchar(1024)
------------------------------------------------------------------------
[2017-03-21 14:23:09] david dot js dot campbell at gmail dot com
Having the exact same issue (PHP 5.6, reproducible on any version as it seems). The issue is we
cannot use the native {SQL Server} driver as it does not support TLS 1.2+
So far the only solution is to cast the column to text when selecting, which is not a solution at
all.
------------------------------------------------------------------------
[2016-12-19 22:12:53] honza dot hink at gmail dot com
Of course, the 64-bit architecture is used in both PHP and ODBC, but the same behavior is in 32-bit
versions. You used different driver "ODBC SQL Server Driver" that has worse bugs. I used
the newest "SQL Server Native Client 11.0".
The worse bug is - text column type must be placed at the end in select list else error is reported.
See my comment here:
http://stackoverflow.com/questions/6361340/java-sql-sqlexceptionmicrosoftodbc-driver-manager-invalid-descriptor-in/31963700#31963700
Both errors are in this drivers for >7 years and to say truth - I dont believe much I will live
to see the see a fix.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=73725
--
Edit this bug report at https://bugs.php.net/bug.php?id=73725&edit=1