Bug #68964 [Com]: Allowed memory size exhausted with odbc_exec

From: Date: Mon, 16 Mar 2015 05:44:54 +0000
Subject: Bug #68964 [Com]: Allowed memory size exhausted with odbc_exec
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191410@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68964&edit=1 ID: 68964 Comment by: xaionaro at gmail dot com Reported by: giodev at panozzo dot it Summary: Allowed memory size exhausted with odbc_exec Status: Closed Type: Bug Package: ODBC related Operating System: Windows Server 2012 PHP Version: 5.6.5 Assigned To: ab Block user comment: N Private report: N New Comment: The bug is still there in PHP-5.6.6 [16-Mar-2015 08:40:10] WARNING: [pool www] child 63955 said into stderr: "NOTICE: PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4294967293 bytes) in /var/www/stpdn.ut.mephi.ru/root/main.php on line 950" # php --version PHP 5.6.6-2 (cli) (built: Feb 24 2015 10:07:30) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies Previous Comments: ------------------------------------------------------------------------ [2015-02-06 18:10:54] ab@php.net @giodev, please check any snapshot starting with rev a41aa46. Thanks. ------------------------------------------------------------------------ [2015-02-06 18:06:18] ab@php.net Automatic comment on behalf of ab Revision: http://git.php.net/?p=php-src.git;a=commit;h=a41aa46759d20e23af92df00b917ca66c6102412 Log: Fixed bug #68964 Allowed memory size exhausted with odbc_exec ------------------------------------------------------------------------ [2015-02-03 16:26:41] giodev at panozzo dot it Update: nxtext and nvrchar(max) fields causes the problem, even if they are empty. If you change the fields to nvarchar(4000), all seems to be working. This bug is similar to bug #67437, but #67437 is linux related. ------------------------------------------------------------------------ [2015-01-31 18:52:04] giodev at panozzo dot it Two more notes: - This happens when querying both MSSQL server Express 2008 or 2012 - Workaround: change ntext field to nvarchar(max) (as explained here: https://msdn.microsoft.com/en-us/library/ms186939.aspx) ------------------------------------------------------------------------ [2015-01-31 18:38:49] giodev at panozzo dot it Description: ------------ I'm running PHP 5.6.5 x64 nts on Windows Server 2012, 64bit, fastcgi. When I execute odbc_exec from a table with ntext field, selecting the ntext field, PHP crashes my script with the following error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1073741824 bytes) in C:\Users\username1\Desktop\odbc_exec_crash_test.php on line 16 The same problem persists with almost all previous versions available on the download site, both 32 and 64 bits, non-thread-safe: php 5.6.5 i386 nts php 5.5.21 x64 nts php 5.4.37 i386 nts Test script: --------------- <?php $dbloc_dsn_srv = "DRIVER={SQL Server Native Client 11.0};Server=MYSERVER\MYINSTANCE". ";ExtendedAnsiSQL=1;Database=mydb;UID=userweb1;PWD=pwdweb"; $cn = odbc_pconnect($dbloc_dsn_srv,"","") or die("Error connecting to DB\n".odbc_errormsg()); print "PHP version ".phpversion()."\n"; $qry = "IF OBJECT_ID('test1', 'U') IS NOT NULL DROP TABLE test1"; $res = odbc_exec($cn,$qry) or die("Drop query error: $qry\n"); $qry = "CREATE TABLE test1 ( id integer not null, field ntext default '' not null, primary key(id))"; $res = odbc_exec($cn,$qry) or die("Query error: $qry\n"); $qry = "SELECT field from test1"; $res = odbc_exec($cn,$qry) or die("Query error: $qry\n"); while( $row = odbc_fetch_object($res) ) { print $row->field."\n"; } print "Done without errors\n"; ?> Expected result: ---------------- PHP version 5.6.5 Done without errors Actual result: -------------- PHP version 5.6.5 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1073741824 bytes) in C:\Users\username1\Desktop\odbc_exec_crash_test.php on line 16 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68964&edit=1

« previous php.bugs (#191410) next »