[wp-trac] [WordPress Trac] #55942: Add a "type" field to the meta and options tables

WordPress Trac noreply at wordpress.org
Wed Jun 8 23:29:40 UTC 2022

#55942: Add a "type" field to the meta and options tables
 Reporter:  azaozz       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  6.1
Component:  Database     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:

Comment (by barry.hughes):

 A possible fourth way (something of a hybrid between the options you
 listed above) would be an enumeration.

 `type` ENUM( 'int', 'float', 'string', 'bool', 'php', 'json' )

 In the above example, we have four scalar types and two serialization
 types—PHP (default/what we use today) and JSON. Introducing JSON as a
 supported serialization method:

 - Could help to mitigate the risk of object injection vulnerabilities
 - In many cases, will consume less storage space (than serialized PHP,
 because less verbose)
 - In some cases, may even perform a little better than serialized PHP

 Some enum pros and cons:

 * Still makes for readable queries
 * Doesn't occupy much space (just 1 byte if we keep the number of enum
 values fairly small)
 * Less flexible than a varchar field

Ticket URL: <https://core.trac.wordpress.org/ticket/55942#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list