|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71577 filter_var / FILTER_SANITIZE_FULL_SPECIAL_CHARS differs from htmlspecialchars
Submitted: 2016-02-12 16:08 UTC Modified: -
From: stheine at arcor dot de Assigned:
Status: Open Package: Filter related
PHP Version: 5.6.18 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: stheine at arcor dot de
New email:
PHP Version: OS:


 [2016-02-12 16:08 UTC] stheine at arcor dot de
documentation ( ) states:

filter_var, option FILTER_SANITIZE_FULL_SPECIAL_CHARS: Equivalent to calling htmlspecialchars() with ENT_QUOTES set.
but in reality, the two differ.

the FILTER_SANITIZE_FULL_SPECIAL_CHARS is missing the FILTER_FLAG_ENCODE_AMP flag (which is not even documented for that filter) to actually be equivalent to htmlspecialchars() as documented.

Test script:
$STRING = "1 2";
echo htmlspecialchars($STRING, ENT_QUOTES)."\n".

1 2
1 2

Expected result:
following the documentation, I expect 


to return

1 2

Actual result:
1 2


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 09:01:23 2021 UTC