|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-03-11 15:41 UTC] evilcart at gmail dot com
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>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 13:00:01 2025 UTC |
"virtual" does subrequest, i.e. does almost the same as include("http://..."). No bug here.