From:             [EMAIL PROTECTED]
Operating system: 
PHP version:      5CVS-2004-08-10 (dev)
PHP Bug Type:     Output Control
Bug description:  php_strip_whitespace() stdout problems

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) ""

-- 
Edit bug report at http://bugs.php.net/?id=29606&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29606&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29606&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29606&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29606&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29606&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29606&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29606&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29606&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29606&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29606&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29606&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29606&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29606&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29606&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29606&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29606&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29606&r=float

Reply via email to