php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22911 Setting odbc.defaultlrl = 0 results in FATAL: emalloc(): Unable to allocate
Submitted: 2003-03-26 16:18 UTC Modified: 2003-08-01 06:10 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: wbarnett at ncta dot com Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 4.3.2RC1 OS: Windows 2000
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: wbarnett at ncta dot com
New email:
PHP Version: OS:

 

 [2003-03-26 16:18 UTC] wbarnett at ncta dot com
Error:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:


FATAL:  emalloc():  Unable to allocate 2012964085 bytes

Note that setting the Setting odbc.defaultlrl = 131072 (as high as I needed to go methinks) works just fine.

Cant get a GDB Backtrace.

Script that generates:


<?php
	$DBName='SpamGenerator';
	$DBUser='Admin';
	$DBPass='';

function ODBCConnect(){
	global $DBName;
	global $DBUser;
	global $DBPass;
	$cnx=odbc_connect($DBName, $DBUser, $DBPass);
	return $cnx;
}	
function GenerateMainTable(){
	$cnx=ODBCConnect();
	$strSQL="SELECT MailID, MailName, MailDate FROM sysMail";
	if (isset($_GET['SortOrder'])){
		$SortOrder=$_GET['SortOrder'];
		$strSQL.=" ORDER BY $SortOrder";
	}
	$cur=odbc_exec($cnx, $strSQL);
	$TableDef="<td class=\"Main\">";
	while (odbc_fetch_row($cur)){
		$MailID=odbc_result($cur, "MailID");
		$MailName=odbc_result($cur, "MailName");
		$MailDate=date('m.d.y', strtotime(odbc_result($cur, "MailDate")));
		echo "<tr>$TableDef<center><a href=\"MailDetail.php?MailID=$MailID\">$MailID</center></td>$TableDef $MailName </td>$TableDef<center>$MailDate</center></td></tr>";
	}
	odbc_close($cnx);
}

GenerateMainTable();

?>

Data it is pulling is pretty simple--an integer ID, a string for name and a date value.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-18 22:32 UTC] kalowsky@php.net
Can you tell me if this is with SQL Server, and which MDAC is being used?  
 [2003-05-18 23:07 UTC] wbarnett at ncta dot com
Not with SQL server, although I can test there too. It happened with an Access DB I was using for development purposes.

WWB
 [2003-07-24 14:12 UTC] m dot tschursch at ic3s dot de
hit exactly the same problem while trying to connect to MSSQL Server !
my software:
PHP: php 4.3.2 
unixODBC: 2.2.5
freeTDS: 0.6.1 
on Linux 

the problem was, that the result-struct was reused 
for all queries i send to db ... so i didnt run into
any problem, till the next querie had more or same count
of columns, but it crashed as i tried to fetch data 
for a 3-column query right after i executed a 
18-column query. doh.

hunted it till i found a solution:
in ext/odbc/php_odbc.c i added a line in function
=========================================================
PHP_FUNCTION(odbc_execute) {
  ....
  	/* Close cursor, needed for doing multiple selects */
	rc = SQLFreeStmt(result->stmt, SQL_CLOSE);

	if (rc == SQL_ERROR) {
	  odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt");	
	}
	rc = SQLExecute(result->stmt);
//
// IMPORTANT !! driver dont seems to set numcols here .. 
        result->numcols = 0; 

========================================================
perhaps this should be done in SQLFreeStmt ... 
i dont know exactly 

finaly this works for me ... perhaps this can help you
 [2003-07-26 12:28 UTC] kalowsky@php.net
Well, that sounds like an easy enough fix, thanks m.tschursch!  wbarnett can you please try the source patch suggested below and tell me if this fixes your problem?

If you cannot compile PHP please let me know and I'll see if I can get you a snapshot with it built-in.  
 [2003-08-01 06:10 UTC] sniper@php.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 "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 17:01:29 2024 UTC