Bug #62032 [NEW]: filter_var incorrectly strips characters from strings after "<"
From:
Operating system: Mac OS X
PHP version: 5.4.3
Package: Filter related
Bug Type: Bug
Bug description:filter_var incorrectly strips characters from strings after "<"
Description:
------------
Noticed that for strings with < in them outside of html tags, filter_var
will
strip out all characters that come after the <.
Test script:
---------------
<?php
$string = 'i want to say that 5 < 10, but it won\'t let me!';
$filtered_string = filter_var($string, FILTER_SANITIZE_STRING);
var_dump($filtered_string);
$filtered_string_strip_tags = strip_tags($string);
var_dump($filtered_string_strip_tags);
Expected result:
----------------
string(47) "i want to say that 5 < 10, but it won't let me!"
string(47) "i want to say that 5 < 10, but it won't let me!"
Actual result:
--------------
string(21) "i want to say that 5 "
string(47) "i want to say that 5 < 10, but it won't let me!"
--
Edit bug report at https://bugs.php.net/bug.php?id=62032&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62032&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62032&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62032&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62032&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62032&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62032&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62032&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62032&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62032&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62032&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62032&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62032&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62032&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62032&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62032&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62032&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62032&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62032&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62032&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62032&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62032&r=mysqlcfg
Thread (12 messages)
- iamcraigcampbell at gmail dot com
- reeze dot xia at gmail dot comBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- iamcraigcampbell at gmail dot comBug #62032 [Opn]: filter_var incorrectly strips characters from strings after "<"
- reeze dot xia at gmail dot comBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- reeze dot xia at gmail dot comBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- iamcraigcampbell at gmail dot comBug #62032 [Opn]: filter_var incorrectly strips characters from strings after "<"
- pajoye@php.netBug #62032 [Opn]: filter_var incorrectly strips characters from strings after "<"
- aleksey dot v dot korzun at gmail dot comBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- iamcraigcampbell at gmail dot comBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- anon at anon dot anonBug #62032 [Com]: filter_var incorrectly strips characters from strings after "<"
- iamcraigcampbell at gmail dot comBug #62032 [Opn]: filter_var incorrectly strips characters from strings after "<"
- cmb@php.netBug #62032 [Opn->Ver]: filter_var incorrectly strips characters from strings after "<"