mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00: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. Fixes #55161. git-svn-id: https://develop.svn.wordpress.org/trunk@52763 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -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'] ) &&
|
||||
|
||||
Reference in New Issue
Block a user