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

From: Date: Sat, 31 Jan 2015 18:38:51 +0000
Subject: Bug #68964 [NEW]: Allowed memory size exhausted with odbc_exec
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190368@lists.php.net to get a copy of this message
From:             giodev at panozzo dot it
Operating system: Windows Server 2012
PHP version:      5.6.5
Package:          ODBC related
Bug Type:         Bug
Bug description:Allowed memory size exhausted with odbc_exec

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



Thread (7 messages)

« previous php.bugs (#190368) next »