Req #69975 [Opn->Fbk]: PHP is causing Apache to crash when accessing nvarchar(max) defined columns

From: Date: Wed, 01 Jul 2015 14:41:50 +0000
Subject: Req #69975 [Opn->Fbk]: PHP is causing Apache to crash when accessing nvarchar(max) defined columns
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194034@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69975&edit=1 ID: 69975 Updated by: ab@php.net Reported by: jgeert1 at its dot jnj dot com Summary: PHP is causing Apache to crash when accessing nvarchar(max) defined columns -Status: Open +Status: Feedback Type: Feature/Change Request Package: PDO ODBC Operating System: Windows Server 2012R2 PHP Version: 5.5.26 Block user comment: N Private report: N New Comment: Thanks for the report. What you say is not quite correct, a lot of ext/odbc related bugs was fixed in the last PHP5 releases, please check the changelog. Could you please also check #68964? As I didn't have the final response there, while the patch was already in releases. What ODBCVER does your phpinfo() show? Which is the SqlServer version? You should probably know also, that nvarchar and others are long deprecated https://msdn.microsoft.com/en-us/library/ms187993%28v=sql.90%29.aspx so should not be used. We depend on the underlying library here, it's not about us making decisions supporting them or not. However it shouldn't crash, that's clear. Thanks. Previous Comments: ------------------------------------------------------------------------ [2015-07-01 08:38:35] jgeert1 at its dot jnj dot com Description: ------------ if you have a MS SQL Database with a table that contains columns defined as NVARCHAR(MAX), PHP will crash Apache when executing the odbc_fetch_array function. Error noted in the Windows Event viewer: Faulting application name: httpd.exe, version: 2.4.9.0, time stamp: 0x53258cd5 Faulting module name: MSVCR110.dll, version: 11.0.51106.1, time stamp: 0x5098826e Exception code: 0xc0000005 Fault offset: 0x000000000003c664 Faulting process id: 0x5c4 Faulting application start time: 0x01d0b31ba3eb507f Faulting application path: D:\wamp\bin\apache\apache2.4.9\bin\httpd.exe Faulting module path: C:\windows\system32\MSVCR110.dll Report Id: 2d47d2ee-1f12-11e5-943b-005056915a28 Additional info: The ODBC driver sees the NVARCHAR(MAX) column as a NVARCHAR(0) column. Probably the zero is causing the odbc driver to loop and consume all available memory. As a workaround I've changed the DSN to use "SQL Server" instead of "SQL Server Native Client 10.0". This is an "old" driver (version 6) which does not support MARS but at least does not cause Apache to crash. It sees the NVARCHAR(MAX) columns as NTEXT columns with a maximum (maxint)size. Test script: --------------- $dbs = odbc_connect("Driver={SQL Server Native Client 10.0"}";Server=MYSERVER1;Database=MYDBS;MARS_Connection=Yes;,"username","password",SQL_CUR_USE_ODBC); $result = odbc_exec($dbs, "select * from Table1"); // Table1 should have a column defined as "NVARCHAR(MAX)" $row = odbc_fetch_array($result); // Apache is crashing when executing the odbc_fetch_array Expected result: ---------------- Please provide support for NVARCHAR(MAX) columns in all odbc implementations for PHP. I did the test with all recent versions of PHP (except version 7) but all of them crash when accessing this type of column though odbc. I know this has been reported many times before, but it has never been finally resolved by putting the support into the binaries for all versions of php. Actual result: -------------- Crash of Apache. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69975&edit=1

« previous php.bugs (#194034) next »