PopupMaker / Popup-Maker

Popup Maker plugin for WordPress
https://wppopupmaker.com/
105 stars 38 forks source link

Error PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array #1054

Closed marklchaves closed 6 months ago

marklchaves commented 11 months ago

Describe the bug

Error PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /wp-content/plugins/popup-maker/classes/Admin/Shortcode/UI.php:173

Site information

Popup Maker version: 1.18.2

WordPress version: 6.3.2

PHP version: 8.1.9

Expected behavior

We should probably check that $plugin_array is valid before calling array_merge().

https://github.com/PopupMaker/Popup-Maker/blob/3e720bf9021f889ee34384b5d5ea417822926b7f/classes/Admin/Shortcode/UI.php#L171

Current behavior

Fatal error thrown when using Popup Maker with WP Frontend Profile plugin.

Steps to reproduce

From the customer.

  1. Fresh WP
  2. Gravity Form
  3. Popup maker

All works fine

  1. Wp Front end profile plugin installed and there the error from PopupMaker appears
  2. Error PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /wp-content/plugins/popup-maker/classes/Admin/Shortcode/UI.php:173

Errors

Error PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /wp-content/plugins/popup-maker/classes/Admin/Shortcode/UI.php:173

Additional context

danieliser commented 6 months ago

Added a check for and cast as array