BoldGrid / weforms

7 stars 11 forks source link

Fatal Error when the form id in the shortcode is not an actual form #220

Closed jamesros161 closed 6 months ago

jamesros161 commented 6 months ago

Replication Steps:

  1. Add a form shortcode to a page, but instead of using a valid form id, use an ID of a standard page or post ( ie home page ).
  2. Save the page / post
  3. View the page / post live.
  4. You should receive the following error:
    PHP Fatal error:  Uncaught TypeError: array_merge(): Argument #2 must be of type array, string given in /var/www/html/feb24/wp-content/plugins/weforms/includes/class-form.php:278
    Stack trace:
    #0 /var/www/html/feb24/wp-content/plugins/weforms/includes/class-form.php(278): array_merge()
    #1 /var/www/html/feb24/wp-content/plugins/weforms/includes/class-form.php(287): WeForms_Form->get_settings()
    #2 /var/www/html/feb24/wp-content/plugins/weforms/includes/class-frontend-form.php(46): WeForms_Form->is_submission_open()
    #3 /var/www/html/feb24/wp-includes/shortcodes.php(433): WeForms_Frontend_Form->render_shortcode()
    #4 [internal function]: do_shortcode_tag()
    #5 /var/www/html/feb24/wp-includes/shortcodes.php(273): preg_replace_callback()
    #6 /var/www/html/feb24/wp-content/plugins/post-and-page-builder/components/class-boldgrid-components-shortcode.php(211): do_shortcode()
    #7 /var/www/html/feb24/wp-includes/class-wp-hook.php(324): Boldgrid_Components_Shortcode->{closure}()
    #8 /var/www/html/feb24/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #9 /var/www/html/feb24/wp-includes/plugin.php(517): WP_Hook->do_action()
    #10 /var/www/html/feb24/wp-admin/admin-ajax.php(192): do_action()
    #11 {main}
    thrown in /var/www/html/feb24/wp-content/plugins/weforms/includes/class-form.php on line 278