Bug #51961 [Fbk->NoF]: ob_start w/ str_ireplace
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:17 +0000 |
| Subject: | Bug #51961 [Fbk->NoF]: ob_start w/ str_ireplace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176856@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51961&edit=1
ID: 51961
Updated by: php-bugs@lists.php.net
Reported by: zane at zanehooper dot com
Summary: ob_start w/ str_ireplace
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Output Control
Operating System: Apache
PHP Version: 5.2.13
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-06-02 08:04:44] aharvey@php.net
That's still incomplete, since it doesn't include the actual array you're giving
str_ireplace() (which is kind of important).
Honestly, I'm kind of inclined to suspect it's a problem in your code, rather than PHP,
since the following code works for me on PHP 5.2:
<?php
function filter_output($text) {
$adjectives = array('quick', 'brown');
return str_ireplace($adjectives, '', $text);
}
ob_start('filter_output');
echo 'The Quick Brown Fox Jumps Over The Lazy Dog';
ob_end_flush();
// Should end up printing "The Fox Jumps Over The Lazy Dog"
?>
------------------------------------------------------------------------
[2010-06-01 13:31:47] zane at zanehooper dot com
Okay, the full script with PHP tags:
<?php
function optimizeHTML( $html )
{
$badwords_array = array( );
$replacement = '';
$html = str_ireplace( $badwords_array, $replacement, $html );
return $html;
}
ob_start( 'optimizeHTML' );
?>
This is CapItalized.
The I or C in CapItalized might be removed, as well as the T in This or The.
------------------------------------------------------------------------
[2010-06-01 09:40:05] aharvey@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2010-06-01 06:02:14] zane at zanehooper dot com
Description:
------------
I am making a bad word replacer using certain profanity settings. Basically, when
I use str_ireplace inside of ob_start, a lot of the capitals on the page are
removed (I didn't see any capitals added).
I'm not sure why it is happening, but I really need this fixed.
Test script:
---------------
function optimizeHTML( $html )
{
$html = str_ireplace( $badwords_array, $replacement, $html );
return $html;
}
ob_start( 'optimizeHTML' );
Expected result:
----------------
A regular page with $badwords_array replaced by $replacement
Actual result:
--------------
Some capitals on the page are removed
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51961&edit=1