[wp-trac] [WordPress Trac] #55942: Add a "value type" parameter to get_option() and get_metadata()

WordPress Trac noreply at wordpress.org
Tue May 9 13:58:02 UTC 2023


#55942: Add a "value type" parameter to get_option() and get_metadata()
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.3
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests needs-      |     Focuses:
  testing                                        |  performance
-------------------------------------------------+-------------------------

Comment (by petitphp):

 >This would also open the door to consider JSON encoding all values except
 strings and class >instances when storing them in the DB. That would
 "enforce" strict types because JSON encoding >preserves the data type
 ($data = json_encode( true ) then json_decode( $data ) would return
 >true). This will fix the above mentioned "weirdness".
 I'm concerned encoding data in DB can limit how we can use it for search
 or in SQL queries (even if it's not a best practice).

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


More information about the wp-trac mailing list