Bug #69203 [Com]: FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127
| From: | dominic at mailinator dot com | Date: | Mon, 20 Apr 2015 12:25:50 +0000 |
| Subject: | Bug #69203 [Com]: FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192239@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69203&edit=1
ID: 69203
Comment by: dominic at mailinator dot com
Reported by: whatthejeff@php.net
Summary: FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127
Status: Closed
Type: Bug
Package: Filter related
PHP Version: 5.5Git-2015-03-09 (Git)
Assigned To: whatthejeff
Block user comment: N
Private report: N
New Comment:
That's a little confusing. Lots of people mean Extended ASCII when they refer to ASCII.
Extended ASCII encodes 256 characters, with the additional 128 characters known as 'High
ASCII'.
Given that the PHP documentation - http://php.net/manual/en/filter.filters.flags.php
- says that these filters encode/strip characters higher than 127 (which is now no longer true?), I
suspect the filter creators and the documenters were referring to High ASCII.
Previous Comments:
------------------------------------------------------------------------
[2015-04-20 12:03:57] whatthejeff@php.net
ASCII only encodes 128 characters. I think LOW/HIGH was meant to reference the non-printable
characters.
------------------------------------------------------------------------
[2015-04-20 11:26:02] dominic at mailinator dot com
Doesn't FILTER_FLAG_ENCODE_HIGH contain the error here? 127 is lower ASCII.
------------------------------------------------------------------------
[2015-03-14 08:20:49] nikic@php.net
Automatic comment on behalf of whatthejeff@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=1e51c5411e2d1bdcddb6731a502ce429605c1d08
Log: Fix #69203: FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127
------------------------------------------------------------------------
[2015-03-09 11:12:31] whatthejeff@php.net
Description:
------------
FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127. This is inconsistent with
FILTER_FLAG_ENCODE_HIGH which encodes ASCII 127 as expected.
Test script:
---------------
// FILTER_FLAG_STRIP_HIGH
var_dump(filter_var("\x7f", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_UNSAFE_RAW, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_STRIP_HIGH));
// FILTER_FLAG_ENCODE_HIGH
var_dump(filter_var("\x7f", FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_HIGH));
var_dump(filter_var("\x7f", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_HIGH));
var_dump(filter_var("\x7f", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH));
Expected result:
----------------
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(6) ""
string(6) ""
string(3) "%7F"
string(6) ""
Actual result:
--------------
string(1) ""
string(1) ""
string(3) "%7F"
string(1) ""
string(6) ""
string(6) ""
string(3) "%7F"
string(6) ""
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69203&edit=1