From: tobe at stonecodex dot com Operating system: Linux PHP version: 5.0.2 PHP Bug Type: Output Control Bug description: echo and print not filtered when stream filter installed on php://output..
Description: ------------ print and echo are not filtered when a stream filter is installed on php://output. Whilst there are workarounds they are either not as flexible (using output_handler) or not as convenient (changing all my echos to fwrites) as the filter pattern. Would argue that if this behaviour is by design then the design should be changed or at the very least the documentation amended to reflect this situation. Reproduce code: --------------- class strtoupper_filter extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $bucket->data = strtoupper($bucket->data); $consumed += $bucket->datalen; stream_bucket_append($out, $bucket); } return PSFS_PASS_ON; } } stream_filter_register("strtoupper", "strtoupper_filter"); $fp = fopen("php://output", "w"); stream_filter_append($fp, "strtoupper"); echo "echo: testing 123<br>"; print("print: testing 123<br>"); fwrite($fp, "fwrite: testing 123<br>"); Expected result: ---------------- ECHO: TESTING 123 PRINT: TESTING 123 FWRITE: TESTING 123 Actual result: -------------- echo: testing 123 print: testing 123 FWRITE: TESTING 123 -- Edit bug report at http://bugs.php.net/?id=30583&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30583&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30583&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30583&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30583&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30583&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30583&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30583&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30583&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30583&r=support Expected behavior: http://bugs.php.net/fix.php?id=30583&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30583&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30583&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30583&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30583&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30583&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30583&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30583&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30583&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30583&r=mysqlcfg