Error in Plugin Cool Timeline (Uncaught TypeError: array_key_exists(): Argument
-
I get the following error under PHP 8.2 WordPress 6.4 and the current (2.9.2) plugin version:
Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in /html/wordpress/wp-content/plugins/cool-timeline/includes/shortcodes/class-ctl-shortcode.php:263
Stack trace: 0 /html/wordpress/wp-content/plugins/cool-timeline/includes/shortcodes/class-ctl-shortcode.php(143): CTL_Shortcode->attributes_migration(Array, ”) 1 /html/wordpress/wp-includes/shortcodes.php(433): CTL_Shortcode->ctl_shortcode_handler(”, ”, ‘…’) 2 [internal function]: do_shortcode_tag(Array) 3 /html/wordpress/wp-includes/shortcodes.php(273): preg_replace_callback(‘…’, ‘…’, ‘…’) 4 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-template-builder/php/class-shortcode-helper.php(580): do_shortcode(‘…’) 5 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-shortcodes/textblock/textblock.php(536): ShortcodeHelper::avia_apply_autop(‘…’) 6 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-template-builder/php/class-shortcode-template.php(1332): avia_sc_text->shortcode_handler(Array, ‘…’, ‘…’, Array) 7 /html/wordpress/wp-includes/shortcodes.php(433): aviaShortcodeTemplate->shortcode_handler_prepare(Array, ‘…’, ‘…’) 8 [internal function]: do_shortcode_tag(Array) 9 /html/wordpress/wp-includes/shortcodes.php(273): preg_replace_callback(‘…’, ‘…’, ‘…’) 10 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-template-builder/php/class-shortcode-helper.php(559): do_shortcode(‘…’) 11 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-shortcodes/section/section.php(1466): ShortcodeHelper::avia_remove_autop(‘…’, true) 12 /html/wordpress/wp-content/themes/wh/config-templatebuilder/avia-template-builder/php/class-shortcode-template.php(1332): avia_sc_section->shortcode_handler(Array, ‘…’, ‘…’, Array) 13 /html/wordpress/wp-includes/shortcodes.php(433): aviaShortcodeTemplate->shortcode_handler_prepare(Array, ‘…’, ‘…’) 14 [internal function]: do_shortcode_tag(Array) 15 /html/wordpress/wp-includes/shortcodes.php(273): preg_replace_callback(‘…’, ‘…’, ‘…’) 16 /html/wordpress/wp-includes/class-wp-hook.php(324): do_shortcode(‘…’) 17 /html/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters(‘…’, Array) 18 /html/wordpress/wp-content/themes/wh/template-builder.php(102): apply_filters(‘…’, ‘…’) 19 /html/wordpress/wp-includes/template-loader.php(106): include(‘…’) 20 /html/wordpress/wp-blog-header.php(19): require_once(‘…’) 21 /html/wordpress/index.php(17): require(‘…’) 22 {main}thrown in /html/wordpress/wp-content/plugins/cool-timeline/includes/shortcodes/class-ctl-shortcode.php on line 263
I have currently fixed this with the following simple code:
public function attributes_migration( $attr, $shortcode_attr ) {
$shortcode_attr = empty($shortcode_attr) ? [] : $shortcode_attr;
if ( ‘horizontal’ === $attr[‘layout’] && ! array_key_exists( ‘items’, $shortcode_attr ) ….I think a corresponding check would be better placed in “ctl_shortcode_handler”. By the way, an empty string ” was passed to the method.
- The topic ‘Error in Plugin Cool Timeline (Uncaught TypeError: array_key_exists(): Argument’ is closed to new replies.