|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-20 20:34 UTC] [email protected]
-Type: Feature/Change Request
+Type: Bug
-Package: Feature/Change Request
+Package: *General Issues
-PHP Version: 5CVS-2005-03-07
+PHP Version: 7.1
[2017-01-20 20:34 UTC] [email protected]
[2020-08-24 19:59 UTC] [email protected]
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: kalle
[2020-08-24 19:59 UTC] [email protected]
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 25 10:00:01 2025 UTC |
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