php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15589 include() output order is weird
Submitted: 2002-02-16 18:59 UTC Modified: 2002-06-18 04:32 UTC
From: webmaster at rosenkeller dot org Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.1.1 OS: Linux (SuSE 7.0)
Private report: No CVE-ID: None
 [2002-02-16 18:59 UTC] webmaster at rosenkeller dot org
Hi,

I've just stumbled across this problem:
I have a few pages which all include one file that does some functionality needed for session management. Now I have a problem in one of these pages (the other ones seem to work): the output from the included file is not completely output before the "including" script continues; instead, I have something like this:
### output from include()
### rest of the "including" file
### output from include() (remaining portion).

In short, the last thing the included file should output is "</table>". But I get everything until "</", then the output from the including file, then "table>".

In "long": I have put the concerned scripts at https://members.rosenkeller.org/phpbug/
The file "logout.php" includes "session.php". The corresponding "logout-src.php" and "session-src.php" simply show the source code of the respective file; I have also included phpinfo.php which shows the results of phpinfo().
If you have a look at the HTML source that output.php produces, you should see what I mean (the "warning: undefined variable" is normal, because there is no session).

I think that this is a bug; if I overlooked something instead (maybe some configuration option?) I'd be pleased to hear what it is...

Thank you in advance, and keep the great work up! :-)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-17 05:05 UTC] sander@php.net
The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php

It's very likeley that you're doing something wrong.
 [2002-02-17 11:45 UTC] webmaster at rosenkeller dot org
Hi,
this actually _is_ a bug :-)

The minimalistic case: you have 2 files:
#a.php
<?php session_start();?>123<!-- hello -->
#b.php
<?php include("a.php"); session_destroy(); ?>456

The output should be "123<!-- hello -->456", right?
But it is "123<!456 -- hello -->".

The same thing happens when using require().
When leaving out the session_destroy() or putting it at the very end of b.php, everything works as expected.

Please check this if you can.
Best regards,
Chris
 [2002-02-17 12:39 UTC] sander@php.net
Can't reproduce...
 [2002-06-18 04:32 UTC] derick@php.net
Can't reproduce this either with 4.2.1. Please try this version and reopen if this is not fixed.

Derick
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 23:00:02 2025 UTC