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

WordPress Trac noreply at wordpress.org
Fri Apr 28 03:57:12 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
-------------------------------------------------+-------------------------
Description changed by azaozz:

Old description:

> Update: This ticket had to be somewhat repurposed as it became clear that
> with the initial approach there's no good way to ensure full backwards
> compatibility in `get_option()` and `get_metadata()`.
>
> The initial idea to support "strict" types of the options and meta values
> remains the same, but the implementation has changed. The new approach is
> to add another parameter to the above functions. This would ensure 100%
> backwards compatibility and at the same time will provide approximately
> the same benefits:
>
> - Consistent types of the return values from `get_option()`,
> `get_metadata()`.
> - Reduced use of `maybe_unserialize()` and `is_serialized()`.
>
> The main differences are that the new approach is opt-in and doesn't
> require new table columns.

New description:

 Update: This ticket had to be somewhat repurposed as it became clear that
 with the initial approach there's no good way to ensure full backwards
 compatibility in `get_option()` and `get_metadata()`.

 The initial idea to support "strict" types of the options and meta values
 remains the same, but the implementation has changed. The new approach is
 to add another parameter to the above functions. This would ensure 100%
 backwards compatibility and at the same time will provide approximately
 the same benefits:
 - Consistent types of the return values from `get_option()`,
 `get_metadata()`.
 - Reduced use of `maybe_unserialize()` and `is_serialized()`.

 The main differences are that the new approach is opt-in and doesn't
 require new table columns.

--

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


More information about the wp-trac mailing list