Bug #67437 [NEW]: error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver

From: Date: Fri, 13 Jun 2014 10:44:52 +0000
Subject: Bug #67437 [NEW]: error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186173@lists.php.net to get a copy of this message
From:             laurent dot mirguet at aufeminin dot com
Operating system: Linux
PHP version:      5.5.13
Package:          ODBC related
Bug Type:         Bug
Bug description:error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver

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 bug report at https://bugs.php.net/bug.php?id=67437&edit=1
-- 



Thread (6 messages)

« previous php.bugs (#186173) next »