|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29606 php_strip_whitespace() stdout problems
Submitted: 2004-08-10 23:15 UTC Modified: 2004-09-25 19:43 UTC
From: Assigned:
Status: Closed Package: Output Control
PHP Version: 5CVS-2004-08-10 (dev) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2004-08-10 23:15 UTC]
The proto and description of php_strip_whitespace() indicate it should return a stripped string. It does not do this and instead outputs the stripped code to stdout.

It looks like the function IS intended to return the stripped string as the code uses output buffering, but the problem lies in php_strip().

Unlike highlight_file() which uses zend_printf()'s and ZEND_PUTC()'s and what-have-you so output buffering works and the result is captured, php_strip() is hardcoded to output to stdout which means the output buffering intended for php_strip_whitespace() doesn't work and an empty string is returned for this function.

It also means, for Apache, since stdout goes nowhere (I think?), nothing is even outputted to the browser.

Fixing this would also close #28280. (same function, different issue)

Reproduce code:
/* ... */

Expected result:
string(63) "<?php
var_dump(php_strip_whitespace($_SERVER['SCRIPT_FILENAME'])); ?>"

Actual result:

var_dump(php_strip_whitespace($_SERVER['SCRIPT_FILENAME'])); ?>
string(0) ""

string(0) ""


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-11 14:46 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 28 10:03:44 2023 UTC