From:             pub1 at hverdag dot dk
Operating system: WinXP Pro
PHP version:      5CVS-2007-10-07 (snap)
PHP Bug Type:     Strings related
Bug description:  strip_tags() interprets <' and <= as tags

Description:
------------
Description:
------------
strip_tags() removes too much information, it incorrectly interprets <'
and <= as tags. In version 5.1.6 strip_tags($string, "<'><=>") (as
mentioned in reproducing code) would solve the problem, but in the
5.2.5-dev snapshot it does not and it even cuts out even more text.

Reproduce code:
---------------
<?php
$string = <<<EOD
Message: Database query for getting dateblock titles failed.
MySQL error: 'opening_date >= '2007-01-01' AND closing_date <' at line 1
SQL: SELECT title FROM dateblocks WHERE opening_date >= '2007-01-01' AND
closing_date <= '2007-12-31'
Level 1 file: C:\Inetpub\wwwroot\includes\ini_functions_dateblock.php /
line <b>563</b>
Level 2 file: C:\Inetpub\wwwroot\includes\ini_functions_dateblock.php /
line <b>750</b> / set_dateblock(<b><font color="brown">'add'</font></b>, 
array(
  'opening_date' => '10/19/2007',
  'closing_date' => '11/3/2007',
  'title' => 'flajdsflkj',
))
EOD;

echo strip_tags($string);  //this does it INCORRECTLY
#echo strip_tags($string, "<'><=>");  //this one does it CORRECTLY in
5.1.6 (but not newest snapshot)
?>


Expected result:
----------------
Only the <b> and <font> tags should be removed.

Actual result:
--------------
Everything after the first "closing_date" is cut off! In 5.1.6 some of the
remaining text was not cut off.

-- 
Edit bug report at http://bugs.php.net/?id=42882&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42882&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42882&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42882&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42882&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42882&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42882&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42882&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42882&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42882&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42882&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42882&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42882&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42882&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42882&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42882&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42882&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42882&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42882&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42882&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42882&r=mysqlcfg

Reply via email to