#36698 [NEW]: headers_sent() returns FALSE when script SSI-included

From: Date: Sat, 11 Mar 2006 14:41:38 +0000
Subject: #36698 [NEW]: headers_sent() returns FALSE when script SSI-included
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94187@lists.php.net to get a copy of this message
From:             evilcart at gmail dot com
Operating system: FreeBSD 5.0 Release
PHP version:      4.4.2
PHP Bug Type:     Apache related
Bug description:  headers_sent() returns FALSE when script SSI-included

Description:
------------
I'm using PHP-script as part of the page by including it in some middle
part of the page (e.g. after some HTML code) using Apache SSI directive
<!--#include ... --> 

So when headers_sent() is called before any script output it returns FALSE
instead of TRUE. Also, header() function called immideately after that does
nothing and executes silently.

As I can understand, any HTML code send before SSI #include of script must
set headers_sent() to TRUE.

I have no any errors suppressed on my php.ini file or by other control
directives.

Reproduce code:
---------------
page.shtml file (simplified):
<html>
<body>
<!--#include vurtual="./script.php?$QUERY_STRING" -->
</body>
</html>

script.php file (simplified):
<?php
$location = "/some/path/";
if( headers_sent() ) {
	echo "<script language="JavaScript"> window.location.href = '" .
$location . "'</sctipt>";
}
else {
	header('Location: '.$location);
	// execution goes HERE! And no any effect or error messages.
}
?>

Expected result:
----------------
<html>
<body>
<script language="JavaScript"> window.location.href = '/some/path/';
</sctipt>
</body>
</html>


Actual result:
--------------
<html>
<body>

</body>
</html>

-- 
Edit bug report at http://bugs.php.net/?id=36698&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36698&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36698&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36698&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36698&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=36698&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36698&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36698&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36698&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36698&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36698&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=36698&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=36698&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36698&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36698&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36698&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36698&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36698&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36698&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36698&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36698&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#94187) next »