Bug #67437 [Com]: error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver
| From: | stefan dot thuering at gmail dot com | Date: | Mon, 13 Oct 2014 09:19:40 +0000 |
| Subject: | Bug #67437 [Com]: error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188054@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67437&edit=1
ID: 67437
Comment by: stefan dot thuering at gmail dot com
Reported by: laurent dot mirguet at aufeminin dot com
Summary: error processing nvarchar(max) types from SQL Server
with MS ODBC Linux Driver
Status: Open
Type: Bug
Package: ODBC related
Operating System: Linux
PHP Version: 5.5.13
Block user comment: N
Private report: N
New Comment:
I have a similar problem on Windows 2008 Server.
Running odbc_exec on a nvarchar(max) col in MSSQL crashes PHP 5.5
This was working on PHP 5.4
Error message:
-------------------------
PHP Fatal error: Out of memory (allocated 786432) (tried to allocate 4294967293 bytes) in
....dbFunction.inc.php on line 27
-------------------------
When the field is nvarchar(4000) everything works.
http://stackoverflow.com/questions/17703180/php-odbc-error-tried-to-allocate-4294967293-bytes
Previous Comments:
------------------------------------------------------------------------
[2014-06-13 10:44:51] laurent dot mirguet at aufeminin dot com
Description:
------------
When using the Microsoft ODBC driver for SQL Server on Linux (see http://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx)
Calling odbc_result() on an nvarchar(max) type results in a memory exhausted error as PHP is trying
to allocate 4Go of RAM (the max size of an nvarchar type).
This seems to happen in the file ext/odbc/php_odbc.c line 2148 :
- the type nvarchar(max) is not recognized in the code, so the switch falls back in the default case
- and the value of result->values[field_ind].vallen is 4Go
I don't know whether the problem comes from the PHP code, the unixODBC code, or the Microsoft
code...
Test script:
---------------
Any odbc_result() call on a non-empty nvarchar(max) type should do the trick and generate a memory
exhauted error.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67437&edit=1