[wp-trac] [WordPress Trac] #32257: Patch: add support for multi-line textarea sanitization
WordPress Trac
noreply at wordpress.org
Tue May 26 13:25:21 UTC 2015
#32257: Patch: add support for multi-line textarea sanitization
-------------------------+------------------------------
Reporter: ottok | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Security | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------------
Comment (by tomauger):
Wow, I totally hate using a string instead of a boolean flag - unless you
take the trouble to create a constant for all valid options to be passed
to the string variable, which is definitely overkill in the case where a
Boolean is clearly the correct variable type.
Sure, the code is more readable at a glance, but it's less writable -
every time you're using a new method, instead of an obviously-named
boolean flag, you have to refer to the source code and look up the allowed
values. Is it "strip", "remove", "clean", "none"? Darn, better look it up.
As for readability of USAGE, well, in most IDEs you can just insert the
cursor and lookup the function signature.
Sorry, I realize this isn't the place to debate already documented
styleguide points, but I thought @Ottok's initial approach with the
boolean flag was the way to go.
/soapbox_rant
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32257#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list