#34863 [NEW]: strip_tags cannot work when string include <img tags
| From: | backdream at gmail dot com | Date: | Fri, 14 Oct 2005 01:24:20 +0000 |
| Subject: | #34863 [NEW]: strip_tags cannot work when string include <img tags | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-86565@lists.php.net to get a copy of this message | ||
From: backdream at gmail dot com
Operating system: Windows
PHP version: 4.4.0
PHP Bug Type: Scripting Engine problem
Bug description: strip_tags cannot work when string include <img tags
Description:
------------
strip_tags cannot work when string include <img tags
Reproduce code:
---------------
<?php
$txt = "Next: <a
href=\"http://www.joelonsoftware.com/uibook/chapters/fog0000000063.html\"
target=\"_blank\">Designing for People Who Have Better Things To Do With
Their Lives, Part Two</a> <br />¡¡¡¡<br />¡¡¡¡<img
src=\"http://86.0.190.20/test/ipb21/skin_acp/IPB2_Standard/images/users.png\"
border=\"0\" align=\"absmiddle\" alt=\"Á´½ÓͼƬ\"
onload=\"if(screen.width*0.7<this.width) {this.resized=true;
this.width=screen.width*0.7;}\" /><br />¡¡¡¡<b>Adverment!</b>
Do you
need to control a computer remotely, even when firewalls get in the way?
My company's latest product, <a href=\"https://www.copilot.com/\"
target=\"_blank\">Fog Creek Copilot</a>, is a remote control system that
requires no setup, no configuration, and works even if both users are
behind firewalls. It's designed to make remote tech support easy. <br
/>¡¡¡¡<br />¡¡¡¡Enter your email address to receive a (very occasional)
email whenever I write a major new article. You can unsubscribe at any
time, of course.<br />¡¡¡¡</div>";
$txt = preg_replace( "#<img[^>]*>#i", "", $txt );
$txt = strip_tags( $txt );
print $txt;
?>
Expected result:
----------------
strip all the html tags
Actual result:
--------------
break when run over <img tag.
--
Edit bug report at http://bugs.php.net/?id=34863&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34863&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34863&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34863&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34863&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34863&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34863&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34863&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34863&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34863&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34863&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34863&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34863&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34863&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34863&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34863&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34863&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34863&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34863&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34863&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34863&r=mysqlcfg