php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21177 cgi shows header output with -q
Submitted: 2002-12-25 01:29 UTC Modified: 2002-12-25 14:41 UTC
From: philip at cornado dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4CVS-2002-12-25 (stable) OS: linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 17 = ?
Subscribe to this entry?

 
 [2002-12-25 01:29 UTC] philip at cornado dot com
I've been looking for PEBKAC but it doesn't seem to be the case.  Here's the commandline output (with some whitespace changes), this is latest checkout of the PHP_4_3 branch and also exists in HEAD:

rock:/cvs/a/php4# cat a.php
<?php
  print "Hello World\n";
?>

rock:/cvs/a/php4# sapi/cgi/php -v
PHP 4.3.0-dev (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

rock:/cvs/a/php4# sapi/cgi/php -q a.php
Content-type: text/html
X-Powered-By: PHP/4.3.0-dev

Hello World

rock:/cvs/a/php4# sapi/cli/php a.php
Hello World

rock:/cvs/a/php4# sapi/cgi/php -h
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>]
       php <file> [args...]
  -a               Run interactively
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.
rock:/cvs/a/php4#


And now from a PHP 4.2.3 CGI binary:


rock:/cvs/a/php4# php4 -v
4.2.3

rock:/cvs/a/php4# php4 a.php
X-Powered-By: PHP/4.2.3
Content-type: text/html

Hello World

rock:/cvs/a/php4# php4 -q a.php
Hello World

rock:/cvs/a/php4#

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-25 02:08 UTC] derick@php.net
Reproduced with HEAD
 [2002-12-25 03:34 UTC] pollita@php.net
Confirmed.

main/main.c seems to have added a second call to sapi_active with r1.515 which is reinitializing the sapi globals after they've been sent (in this case, 'headers_sent' being set to '1' by the -q option)

Checking with patch committer...
 [2002-12-25 14:41 UTC] gschlossnagle@php.net
Fixed in cvs.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 17:05:44 2022 UTC