From e76f331139df4f5e8035897fed228efa964da841 Mon Sep 17 00:00:00 2001 From: Phil Date: Wed, 12 Mar 2014 13:44:25 +0000 Subject: [PATCH] Resolve issue where we only get the first character of the label/value Inconsistent behaviour between PHP versions, see http://stackoverflow.com/a/9132759/2927691. ```php $option = 'Boom'; $opt_label = isset( $option['name'] ) ? $option['name'] : $option; print_r( $opt_label ); // "B" on PHP 5.3, "Boom" on PHP 5.4 ``` --- helpers/cmb_Meta_Box_types.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/cmb_Meta_Box_types.php b/helpers/cmb_Meta_Box_types.php index 01e960f..d409334 100644 --- a/helpers/cmb_Meta_Box_types.php +++ b/helpers/cmb_Meta_Box_types.php @@ -412,8 +412,8 @@ public function concat_options( $args = array(), $method = 'list_input' ) { foreach ( $options as $option_key => $option ) { // Check for the "old" way - $opt_label = isset( $option['name'] ) ? $option['name'] : $option; - $opt_value = isset( $option['value'] ) ? $option['value'] : $option_key; + $opt_label = is_array( $option ) && array_key_exists( 'name', $option ) ? $option['name'] : $option; + $opt_value = is_array( $option ) && array_key_exists( 'value', $option ) ? $option['value'] : $option_key; $selected = $value == $opt_value; if ( ! empty( $args ) ) {