Welcome! » Log In » Create A New Profile

purifyArray() with arrays inside array to purify

Posted by ndorphin 
purifyArray() with arrays inside array to purify
February 17, 2015 09:39PM


the purifyArray() function works not very well with arrays inside the array to purify. E.g. you could have arrays inside POST values (php support by field names with brackets like field[0]). Trough google i found some others have had the same problem. The solution is very simple (for me), just add an is_array() check inside the foreach loop within purifyArray() with a recursive call of purifyArray() for the value and it's solved.

Maybe it's worth to think about to add this small change in a later release.

best ndorphin

Your Email:


HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}