emrikol / focus

File-based Object Cache is Utterly Slow: An Object Caching Dropin for WordPress that uses the local file system
https://wordpress.org/plugins/focus-object-cache/
GNU General Public License v3.0
6 stars 2 forks source link

Unnecessary double sanitisation and double unslashing #3

Closed david-binda closed 7 years ago

david-binda commented 7 years ago

The code in FOCUS_Cache::render_admin_page is double sanitising the $action variable via sanitize_text_field.

First in https://github.com/emrikol/FOCUS/blob/master/focus-cache.php#L126 and for second time in https://github.com/emrikol/FOCUS/blob/master/focus-cache.php#L130

It's really needed only once.

Further, the double wp_unslash call may actually introduce some unwanted bugs. Eg.:

wp> addslashes( "O\'Reilly" );
string(11) "O\\\'Reilly"
wp> wp_unslash( "O\\\'Reilly" );
string(9) "O\'Reilly"
wp> wp_unslash( "O\'Reilly" );
string(8) "O'Reilly"
emrikol commented 7 years ago

Hopefully fixed by #6 :)