[wp-trac] [WordPress Trac] #60355: Can't save object to metadata with `readonly` properties
WordPress Trac
noreply at wordpress.org
Fri Jan 26 20:36:14 UTC 2024
#60355: Can't save object to metadata with `readonly` properties
-------------------------+---------------------
Reporter: Cawa-93 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.5
Component: Formatting | Version:
Severity: minor | Resolution:
Keywords: needs-docs | Focuses:
-------------------------+---------------------
Changes (by azaozz):
* keywords: => needs-docs
* type: defect (bug) => enhancement
* severity: major => minor
* milestone: Awaiting Review => 6.5
Comment:
This sounds like PHP limitation, maybe check
https://www.php.net/manual/en/language.oop5.serialization.php.
Think this is a documentation problem in WP. Imho the docblocks for adding
options and meta should state clearly that saving instances of PHP objects
to the DB is not recommended and that only simple objects are supported
(like plain name->value pairs?). Also that the preferable format to save
to the DB are strings or associative arrays, not objects.
Setting this as a "documentation enhancement" for 6.5.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60355#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list