WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 13 months ago

#38379 new feature request

Add server side validation class in wordpress core

Reported by: lpkapil008 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: External Libraries Keywords:
Focuses: Cc:

Description

Server side validations are most effective way of filtering the input. WordPress does not have any inbuilt validation library or class for server side validations.There are many several libraries available that can be used for this.

I would suggest using opensource library or better we can class for validations.
Valitron https://github.com/vlucas/valitron, It is tried and tested in many projects, And simply it works like charm.

Change History (2)

#1 @swissspidy
13 months ago

Hey there,

Thanks for opening this ticket. Valitron is not compatible with PHP 5.2 as it uses namespaces. Thus, we can't use it in core.

Can you perhaps elaborate on why such a library is needed and the built-in sanitizing and escaping functions do not suffice?

#2 @lpkapil008
13 months ago

Hi swissspidy,

I understand your opinion. But yes in terms of validation escaping functions are not sufficient. In complex projects we need to validation different kind of ranges and types and need to check limits, for that having a standard library/class is a really good option instead of using functions or writing custom functions for checking ranges and limits etc.

About validation library valitron, We can remove the namespace to make it compatible with PHP5.2. Validation Class always work either with namespace or without namespace.

Also having an inbuilt validation class will be an extra feature in CMS, instead of looking for functions and creating custom functions for complex validations.

Note: See TracTickets for help on using tickets.