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

WordPress Trac noreply at wordpress.org
Thu Jul 21 08:38:58 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:  needs-unit-tests needs-patch  |     Focuses:
------------------------------------------+---------------------

Comment (by barry.hughes):

 > I'm a bit "uneasy" specifying "json" as type in that way.

 To offer an alternative stance: serialization is pretttty useful, and of
 course we aren't getting rid of it with this proposal.

 Native JSON support simply means there would be support for a safer (but
 also more limited) form of serialization with different 'performance'
 characteristics (I'm using that a little loosely to mean not just runtime
 costs, but space requirements -- JSON tends to be more compact).

 The big win here in my opinion though is safety (object injection not
 being possible with JSON), and I think there is value in WordPress
 offering that safer path.

 That said...

 > If a plugin wants to use JSON, it would be pretty easy to encode the
 value before passing it to the API.

 Yep, also true, and it doesn't close off a future where some kind of
 wrapper for JSON-encoded options is supported by WP (out of scope here).

 > Wondering if NULL (the PHP type) should map to "NULL" in the ENUM. Seems
 logical but might run into some problems later on, perhaps?

 Less sure about this.

 We could be visualizing different parts of the problem but, from a back-
 compat perspective, I'd have thought null (PHP) would map to 'original
 Options API behaviour', in essence [?]

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


More information about the wp-trac mailing list