mirror of
git://develop.git.wordpress.org/
synced 2025-04-14 09:02:06 +02:00
Editor: Adds an additional check to guard against incompete presets.
Adds an additional guard to ensure the value of `$preset_metadata['value_key']` actually exists as a key in the `$preset` array. Fixes `Warning: Undefined array key` error. Intentionally adds the check into the existing `isset()` as it's native to PHP, more efficient, and a good pattern. Follow-up [52049]. Props jeherve, swissspidy, sergeybiryukov, jrf. Merges [52763] to the 5.9 branch. Fixes #55161. git-svn-id: https://develop.svn.wordpress.org/branches/5.9@52764 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2f1ca7986c
commit
7a401187ce
@ -1092,7 +1092,7 @@ class WP_Theme_JSON {
|
||||
$slug = _wp_to_kebab_case( $preset['slug'] );
|
||||
|
||||
$value = '';
|
||||
if ( isset( $preset_metadata['value_key'] ) ) {
|
||||
if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) {
|
||||
$value_key = $preset_metadata['value_key'];
|
||||
$value = $preset[ $value_key ];
|
||||
} elseif (
|
||||
@ -1837,7 +1837,7 @@ class WP_Theme_JSON {
|
||||
sanitize_html_class( $preset['slug'] ) === $preset['slug']
|
||||
) {
|
||||
$value = null;
|
||||
if ( isset( $preset_metadata['value_key'] ) ) {
|
||||
if ( isset( $preset_metadata['value_key'], $preset[ $preset_metadata['value_key'] ] ) ) {
|
||||
$value = $preset[ $preset_metadata['value_key'] ];
|
||||
} elseif (
|
||||
isset( $preset_metadata['value_func'] ) &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user