php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1761 require/include functions broken -- give "document contains no data error"
Submitted: 1999-07-20 14:14 UTC Modified: 2000-11-09 10:22 UTC
From: dmf14 at cornell dot edu Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.3pl1 OS: Linux
Private report: No CVE-ID: None
 [1999-07-20 14:14 UTC] dmf14 at cornell dot edu
Using the include or require function, seemingly anywhere, in a PHP script yields a "Document contains no data" error in Netscape or a "Unexpected network read error; connection aborted/Unable to access document" error in lynx.

Example:
file "foo.inc" contains one line:
Hello

file "foo.php" contains six lines:
<html><head><title>Hello World!</title></head><body>
<?
        require('foo.inc');
        echo " world!<br>\n";
?>
</body></html>


Compile Information:  Have PHP4 compiled as a shared Apache module (DSO) under Apache 1.3.6.
Configure line:  ./configure --with-apxs=/usr/sbin/apxs --with-mysql --enable-track-vars 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-31 13:20 UTC] zeev at cvs dot php dot net
This is an Apache bug - Apache doesn't always properly generate
DSO modules.
It's fixed in Apache 1.3.7/1.3.8
 [2000-11-05 03:46 UTC] dmf14 at cornell dot edu
I have Apache 1.3.9 and include'ing doesn't work properly.

Please take a look at this:

http://zeraim.torah.org/~cblack/testdir/index.php3

http://zeraim.torah.org/~cblack/testdir/index.php3?sid=3

Now, try these:

http://terumah.teamgenesis.com/~cblack/index.php3

http://terumah.teamgenesis.com/~cblack/index.php3?sid=2

Precisely the same code. PHP on zeraim incorporates the header & footer and 
then parses all as one, while on terumah it is attempting to parse the 
header & footer as if they were independent of the file into which they are 
included.

Or in other words, PHP used to incorporate a 'require()ed' file without 
doing any work on it, and then parsed the whole thing together. So you 
could have an IF statement in the header [ if (...) { ] that ended in the 
footer [ } ].

No longer! That's why the same code is generating parse errors.

 [2000-11-05 03:47 UTC] dmf14 at cornell dot edu
brozen@torah.org added that last comment
 [2000-11-09 10:22 UTC] sniper@php.net
Please read the manual:

http://www.php.net/manual/function.require.php

--Jani
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC