PHP Classes

File: src/voku/helper/AntiXSS.php

Recommend this page to a friend!
  Classes of Lars Moelleken   PHP Anti XSS Filter   src/voku/helper/AntiXSS.php  
File: src/voku/helper/AntiXSS.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Anti XSS Filter
Remove tags from HTML that may cause XSS attacks
Author: By
Last change: Added onTransitionRun to the unsafe events
[*]: "To people of Russia" -> Info about the war in Ukraine
[+]: optimize "_do_never_allowed_afterwards" -> thanks @Fahl-Design

-> I only fixed the "valid string without attribute XSS" in tags, because "\s*onEnd\s*" could be added into html tags.
#99 optimize regex to "_sanitize_naughty_javascript" by adding a negative look behind

- add test cases
- change js test result (no longer false positive)

Signed-off-by: Benjamin Fahl <>
Apply fixes from StyleCI
[+]: "AntiXSS" -> move more static data into the object

-> workaround for issue #95
[+]: fix / ignore phpstan reported issues
[+]: fix issue #83
[+]: optimize decoding the html-tags

thanks @gharlan for the fix:
Date: 3 months ago
Size: 66,972 bytes

You need to be a registered user and login to get this file.

1,606,013 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on: