WordPress / WordPress/secure-custom-fields
Meta/Option.php diverges from MetaLocation base: missing unserialize in get_meta(), inverted slashing in update_meta()
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 131
- Forks
- 64
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
Description
Two consistency bugs in the options meta backend, found via integration tests of all Meta backends:
Option::get_meta()never unserializes values. UnlikeMetaLocation::get_meta(), which runs values throughacf_maybe_unserialize(), the option backend returns raw strings — soacf_get_meta( 'options' )yields serialized array strings where every other location yields arrays.Option::update_meta()callswp_unslash()on values, whileMetaLocation::update_meta()wp_slash()es beforeupdate_metadata(). Net effect:acf_copy_metadata()to an options location strips backslashes (C:\temp\newbecomesC:tempnew), while post-to-post copies preserve them.
Affected code
includes/Meta/Option.php:45(get_meta)includes/Meta/Option.php:87(update_meta)
Reproduction
Repro tests in #450, tests/php/includes/meta/test-meta-locations.php:
test_option_get_meta_pairs_values_with_referencestest_option_update_meta_unslashes_values
Note before fixing
These code paths are ported from upstream — verify whether the same behavior exists upstream first. If it does, a divergence decision is needed (or an upstream-first fix); if it does not, this is a porting regression and can be fixed directly.
Found during the 2026-06 test campaign (see PR #450).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing includes/Meta/Option.php at get_meta and update_meta with the upstream implementation, as requested. Run the two named tests in tests/php/includes/meta/test-meta-locations.php and inspect PR #450; done means the options backend matches MetaLocation behavior without breaking the integration tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100