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

From: Date: Wed, 01 Jul 2015 08:38:39 +0000
Subject: Req #69975 [NEW]: PHP is causing Apache to crash when accessing nvarchar(max) defined columns
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194026@lists.php.net to get a copy of this message
From:             jgeert1 at its dot jnj dot com
Operating system: Windows Server 2012R2
PHP version:      5.5.26
Package:          PDO ODBC
Bug Type:         Feature/Change Request
Bug description:PHP is causing Apache to crash when accessing nvarchar(max) defined columns 

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 bug report at https://bugs.php.net/bug.php?id=69975&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=69975&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=69975&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=69975&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=69975&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=69975&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=69975&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=69975&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=69975&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=69975&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=69975&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=69975&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=69975&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=69975&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69975&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=69975&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=69975&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=69975&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69975&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=69975&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=69975&r=mysqlcfg



Thread (17 messages)

« previous php.bugs (#194026) next »