php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #21391 header page example bogus
Submitted: 2003-01-03 08:17 UTC Modified: 2003-01-03 09:30 UTC
From: goba@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0 OS: n/a
Private report: No CVE-ID: None
 [2003-01-03 08:17 UTC] goba@php.net
The example on http://php.net/header:

| <?php header ("Content-type: audio/x-pn-realaudio"); ?>
| // Broken, note the blank line above

Is bogus, because whitespace before and after examples is stripped off, so the example should be modified to have a different error case presented.

Ie:

| <html>
| <?php header ("Location: http://www.example.com/"); ?>
| // Broken, note the script output above

I cannot do this myself now...

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-03 09:22 UTC] tularis@php.net
I agree that the example is a little bit faulty, but let me explain what is ment there IMHO:

You should not send any output before the header() calls, blanc lines before <?php also count as output, and thus break your script.

I will change it in the docs though
 [2003-01-03 09:30 UTC] tularis@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

because it seems that empty lines before <?php aren't recognised in the 
<![CDATA[

I added a echo ' ';
before the header(), though a little different, it serves the same cause
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 12:01:27 2024 UTC