Skip to content

Meta/Option.php diverges from MetaLocation base: missing unserialize in get_meta(), inverted slashing in update_meta() #454

@cbravobernal

Description

@cbravobernal

Description

Two consistency bugs in the options meta backend, found via integration tests of all Meta backends:

  1. Option::get_meta() never unserializes values. Unlike MetaLocation::get_meta(), which runs values through acf_maybe_unserialize(), the option backend returns raw strings — so acf_get_meta( 'options' ) yields serialized array strings where every other location yields arrays.
  2. Option::update_meta() calls wp_unslash() on values, while MetaLocation::update_meta() wp_slash()es before update_metadata(). Net effect: acf_copy_metadata() to an options location strips backslashes (C:\temp\new becomes C: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_references
  • test_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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions