0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 16:31:53 +00:00

Fix PHP 5.3.0 problem with numeric indices causing -0 problem.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang 2009-06-07 16:04:07 -04:00
parent 6e66dc9cad
commit 1b8c8865b2

View File

@ -21,11 +21,14 @@ class HTMLPurifier_AttrDef_HTML_Class extends HTMLPurifier_AttrDef_HTML_Nmtokens
foreach ($tokens as $token) { foreach ($tokens as $token) {
if ( if (
($allowed === null || isset($allowed[$token])) && ($allowed === null || isset($allowed[$token])) &&
!isset($forbidden[$token]) !isset($forbidden[$token]) &&
// We need this O(n) check because of PHP's array
// implementation that casts -0 to 0.
!in_array($token, $ret, true)
) { ) {
$ret[$token] = true; $ret[] = $token;
} }
} }
return array_keys($ret); return $ret;
} }
} }