php.net |  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: dave@php.net Assigned:
Status: Closed Package: Output Control
PHP Version: 5CVS-2004-08-10 (dev) OS:
Private report: No CVE-ID: None
 [2004-08-10 23:15 UTC] dave@php.net
Description:
------------
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:
---------------
<?php
/* ... */
var_dump(php_strip_whitespace($_SERVER['SCRIPT_FILENAME']));
?>

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

Actual result:
--------------
CLI:

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

Apache:
string(0) ""

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-11 14:46 UTC] iliaa@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 00:01:32 2024 UTC