PHP 4.0 Bug #8271 Updated: Using include() on file with javascript after session_start() corrupts output
| From: | cynic@php.net | Date: | Sat, 20 Jan 2001 01:21:26 +0000 |
| Subject: | PHP 4.0 Bug #8271 Updated: Using include() on file with javascript after session_start() corrupts output | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44614@lists.php.net to get a copy of this message | ||
ID: 8271
Updated by: cynic
Reported By: bobm-php@burner.com
Old-Status: Open
Status: Duplicate
Old-Bug Type: IIS related
Bug Type: *Session related
Assigned To:
Comments:
duplicate of #8311
Previous Comments:
---------------------------------------------------------------------------
[2000-12-15 04:18:35] bobm-php@burner.com
Using IIS 4.02.0720 and PHP4.0.3p1 as a DLL; No additional modules.
If I include() a file with Javascript in it _after_ having done a session_start(), the resulting
file spit out with include() contains a bunch of errant quotation marks at odd places in the
Javascript, causing it to fail in the browser. If I don't ever start a session, it works fine.
Additional tests done: Reading the html directly via IIS works fine; Reading it through IIS as a
.php works fine; include()ed without session_start() works fine.
Consider two files:
[File: test.php]
<?
session_start();
include( "test.html" );
?>
[File: test.html]
<html>
<head>
<title>Crosspoint Clients</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v3.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
---8<---
If you dial up test.php through IIS, you will wind up with some quotes thrown in before the closing
braces of some of the Javascript functions, as well as duplicate quotes or inserted quotes in the
functions themselves. Comment out the session_start() in test.php and they go away.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8271