php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67437 error processing nvarchar(max) types from SQL Server with MS ODBC Linux Driver
Submitted: 2014-06-13 10:44 UTC Modified: 2015-02-15 04:22 UTC
Votes:4
Avg. Score:4.2 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: laurent dot mirguet at aufeminin dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.5.13 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laurent dot mirguet at aufeminin dot com
New email:
PHP Version: OS:

 

 [2014-06-13 10:44 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-13 09:19 UTC] stefan dot thuering at gmail dot com
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
 [2015-02-06 18:08 UTC] ab@php.net
@laurent, please check the current 5.5+ tree.

Thanks.
 [2015-02-06 18:08 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2015-02-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2015-02-19 15:53 UTC] sinasalek at gmail dot com
Using PHP 5.6.5 on Ubuntu Linux 64bit. and still experiencing the same problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 00:01:27 2024 UTC