|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 11:01:23 2020 UTC