PHP 4.0 Bug #6065 Updated: Returns a "The document contained no data" error while accessing MS-SQL 7.0
| From: | fmk@php.net | Date: | Fri, 20 Oct 2000 21:12:28 +0000 |
| Subject: | PHP 4.0 Bug #6065 Updated: Returns a "The document contained no data" error while accessing MS-SQL 7.0 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35692@lists.php.net to get a copy of this message | ||
ID: 6065
Updated by: fmk
Reported By: jms18@guinness.som.cwru.edu
Status: Closed
Bug Type: MSSQL related
Assigned To:
Comments:
Some memory issues was fixed in php 4.0.3, and additional fixxes is available in cvs. Please update
and try again.
Previous Comments:
---------------------------------------------------------------------------
[2000-08-11 00:54:08] jms18@guinness.som.cwru.edu
Here is a shorter script that produces the same results:
<?
print("<HTML>n<HEAD>n<TITLE>nPHP Helpdesk v0.0.1
Alphan</TITLE></HEAD>n<BODY>n");
$MSsqlLink = mssql_connect("Server","User","password") or
DIE("SERVER FAILED TO RESPOND.");
mssql_select_db("Database") or DIE("Database unavailable");
$Result = mssql_query("select
tbl_WO_Entry.WO_nos,tbl_WO_Entry.UserName,tbl_WO_Entry.Status,tbl_WO_Entry.Priority,tbl_WO_Description.Problem_description
from tbl_WO_Entry, tbl_WO_Description where ((tbl_WO_Entry.WO_nos = tbl_WO_Description.WO_nos) and
(not (tbl_WO_Entry.status = 3 and tbl_WO_Entry.status = 4 and tbl_WO_Entry.status = 5))) order by
tbl_WO_Entry.Priority,tbl_WO_Entry.WO_nos",$MSsqlLink);
print("<TABLE ALIGN=CENTER COLS=5 CELLSPACING=0 BORDER=1 CELLPADDING=0
WIDTH="100%">n");
print("<TR>n<TH WIDTH="5%">WO#</TH>n<TH
WIDTH="10%">User</TH>n<TH WIDTH="5%">Priority</TH>n");
print("<TH WIDTH="60%" ABBR>Description</TH>n<TH
WIDTH="10%">Status</TH>n</TR>n");
$WORS = mssql_fetch_row($Result);
print("<TR>n<TD>$WORS[0]</TD>n<TD>$WORS[1]</TD>n<TD>$WORS[3]</TD>n");
print("<TD>$WORS[4]</TD>n<TD>$WORS[2]</TD>n</TR>n");
$WORS = mssql_fetch_row($Result);
print("<TR>n<TD>$WORS[0]</TD>n<TD>$WORS[1]</TD>n<TD>$WORS[3]</TD>n");
print("<TD>$WORS[4]</TD>n<TD>$WORS[2]</TD>n</TR>n");
$WORS = mssql_fetch_row($Result);
print("<TR>n<TD>$WORS[0]</TD>n<TD>$WORS[1]</TD>n<TD>$WORS[3]</TD>n");
print("<TD>$WORS[4]</TD>n<TD>$WORS[2]</TD>n</TR>n");
$WORS = mssql_fetch_row($Result);
print("<TR>n<TD>$WORS[0]</TD>n<TD>$WORS[1]</TD>n<TD>$WORS[3]</TD>n");
print("<TD>$WORS[4]</TD>n<TD>$WORS[2]</TD>n</TR>n");
print("</TABLE>n");
mssql_close();
print("n</BODY>n</HTML>");
?>
---------------------------------------------------------------------------
[2000-08-10 05:18:34] jms18@guinness.som.cwru.edu
I can access the database (MS-SQL 7.0 service pack 1) from other scripts. It is one I try to loop
through the reordset that it will die.
---------------------------------------------------------------------------
[2000-08-10 05:16:47] jms18@guinness.som.cwru.edu
Here is the source:
<?
PrintHeader();
DisplayQueue();
PrintClose();
function PrintHeader()
{
print("<HTML>n<HEAD>n<TITLE>nPHP Helpdesk v0.0.1
Alphan</TITLE></HEAD>n<BODY>n");
}
function PrintClose()
{
print("n</BODY>n</HTML>");
}
function ConnectDB($Server,$Database,$DBUser,$DBPsswrd)
{
$mssql_link = mssql_connect($Server,$DBUser,$DBPsswrd) or DIE("SERVER FAILED TO
RESPOND.");
mssql_select_db($Database) or DIE("Database unavailable");
return $mssql_link;
}
function RunQuery($Query, $Fetch, $Link)
{
if ($Fetch == 1)
{
return mssql_fetch_row(mssql_query($Query,$Link));
}
else
{
return mssql_query($Query,$Link);
}
}
function OpenTable($Alignment,$ColNumber,$CellSpace,$Border,$CellPadding,$Width)
{
print("<TABLE ALIGN=$Alignment COLS=$ColNumber CELLSPACING=$CellSpace BORDER=$Border
CELLPADDING = $CellPadding WIDTH=$Width>n");
}
function DisplayQueue()
{
$MSsqlLink =
ConnectDB("Server","Datbase","user","password");
$Result = RunQuery("select * from tbl_WO_Entry, tbl_WO_Description, tbl_WO_Classification
where ((tbl_WO_Entry.WO_nos = tbl_WO_Description.WO_nos and tbl_WO_Entry.WO_nos =
tbl_WO_Classification.WO_nos) and (not (tbl_WO_Entry.status = 3 and tbl_WO_Entry.status = 4 and
tbl_WO_Entry.status = 5))) order by tbl_WO_Entry.Priority,tbl_WO_Entry.WO_nos",0,$MSsqlLink);
OpenTable("CENTER",5,0,1,0,"100%");
print("<TR>n<TH WIDTH="5%">WO#</TH>n<TH
WIDTH="10%">User</TH>n<TH WIDTH="5%">Priority</TH>n");
print("<TH WIDTH="60%" ABBR>Description</TH>n<TH
WIDTH="10%">Status</TH>n</TR>n");
$Number = mssql_num_rows($Result);
print("$Number<BR>");
while($WORS = mssql_fetch_row($Result))
{
PrintQueueRow($WORS[0],$WORS[1],$WORS[3],$WORS[5],$WORS[2]);
}
print("</TABLE>n");
mssql_close();
}
function PrintQueueRow($WONos,$UserName,$Priority,$Description,$Status)
{
print("<TR>n<TD>$WONos</TD>n<TD>$UserName</TD>n<TD>$Priority</TD>n");
print("<TD>$Description</TD>n<TD>$Status</TD>n</TR>n");
}
?>
Here is the backtrace:
cd htdocs[root@som00258 apache]# gdb /usr/local/apache/bin/httpd
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x80e4843 in zend_hash_index_find ()
(gdb)
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6065