#46998 [Opn->Fbk]: include inside include generates junk output

From: Date: Sun, 04 Jan 2009 02:42:13 +0000
Subject: #46998 [Opn->Fbk]: include inside include generates junk output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132535@lists.php.net to get a copy of this message
 ID:               46998
 Updated by:       jani@php.net
 Reported By:      ian at ianhobson dot co dot uk
-Status:           Open
+Status:           Feedback
 Bug Type:         *General Issues
 Operating System: windows 2000
 PHP Version:      5.2.8
 New Comment:

BOM?


Previous Comments:
------------------------------------------------------------------------

[2009-01-03 23:44:54] ian at ianhobson dot co dot uk

My server is set up to use utf8. I did not notice this problem when
using Latin1.

------------------------------------------------------------------------

[2009-01-03 23:43:26] ian at ianhobson dot co dot uk

Description:
------------
include-ing a file that includes another file before producing any
output, results in a few invalid characters being emitted before the
<DOCTYPE> line



Reproduce code:
---------------
Create a file with any trivial content. 

Include, require or require_once it from a second file. This second
file needs the php tags and the include line only. 

Include this second file in a page like this (which is valid). 
 
<?php // test0.php
require_once "test1.php";
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<title>Test Demo Page</title>
</head><body>
<p>This page has junk before the doctype</p>
</body></html>

Expected result:
----------------
The source should start with the "<" of the doctype line as its first
character. 

Actual result:
--------------
In iIE source, you will see 6 squares before the <!DOC...

In Firefox validator it will complain about invalid characters in the
prolog. 

If you move the content of the inner file up a level, all works
correctly. 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46998&edit=1



Thread (4 messages)

« previous php.bugs (#132535) next »