Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #55942, comment 25


Ignore:
Timestamp:
10/21/2022 10:13:53 PM (2 years ago)
Author:
barry.hughes
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #55942, comment 25

    initial v1  
    11What do we think about the (optional) ability to specify the underlying type, on read as well as upon write?
    22
    3 For instance, to maintain full backwards compatibility there are surely going to be cases where PHP serialization is still required. However, as a plugin author, if I can also specify (upon read) that I expect the value to be a simple boolean, or to have been written using JSON serialization, that would close off scenarios where third party code replaces an option with a value requiring PHP serialization (because what would be less desirable in such a case is if WP goes ahead and uses `unserialize()` when reading that data, contrary to my intentions).
     3For instance, to maintain full backwards compatibility, there are surely going to be cases where PHP serialization is still required. However, as a plugin author, if I can also specify (upon read) that I expect the value to be a simple boolean, or to have been written using JSON serialization, that would close off scenarios where third party code replaces an option with a value requiring PHP serialization (because what would be less desirable in such a case is if WP goes ahead and uses `unserialize()` when reading that data, contrary to my intentions).