• Hi,

    A fatal error appeared after updating to 5.4.1.

    In class-cf7-2-post-factory.php, line 149
    $mapper is null

    The $post_type_source variable used in the switch has a value that is not used in the switch : “filter”

    The switch (line 142) only knows “system” and “factory”, so with “filter”, $mapper stays null.

    Do you know what could be causing this ?

    I bypassed the error by returning false in this case, not sure if this is the right thing to do.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    thanks for reporting this…completely forgotten about the filter type of mapper…that’s a long way back!

    let me get back to you on this

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I have attempted a fix for this and release v5.4.3 beta on the GitHub repo. Could you manually update and let me know if it works for you?

    Thread Starter flx0

    (@flx0)

    Thanks for your quick reaction,
    Unfortunately the error is still here after updating :

    Fatal error: Uncaught Error: Call to a member function load_post_mapping() on null
    in /wp-content/plugins/post-my-contact-form-7/includes/class-cf7-2-post-factory.php on line 149

    Thread Starter flx0

    (@flx0)

    I also found this one in admin (CF7 settings) :

    Fatal error: Uncaught Error: Call to a member function get() on bool
    in /wp-content/plugins/post-my-contact-form-7/admin/partials/cf7-2-post-admin-panel-display.php on line 17

    Plugin Author Aurovrata Venet

    (@aurovrata)

    ah yes, sorry about that.

    I fixed this in v5.4.3beta2

    can you let me know if it works now?

    Thread Starter flx0

    (@flx0)

    I’m sorry to inform you that it’s still fatal erroring :p

    class-cf7-2-post-factory.php on line 149

    I think you’ll have to add a case for filter in that switch

    Plugin Author Aurovrata Venet

    (@aurovrata)

    it shouldn’t reach that point.

    Are you getting the error on a front-end form submission or admin dashboard?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    if front-end form submission, could you look up the wp_postmeta table and search for the post_id of your form, and the meta_key %like% _cf7_2_post

    image

    and post the values here

    Thread Starter flx0

    (@flx0)

    Are you getting the error on a front-end form submission or admin dashboard?

    Both, the fatal error appears without any action, on front-end and in admin.
    The website is inaccessible if the plugin is active.

    Here are the values you asked :

    642702	31722	_cf7_2_post-type_source	filter
    642703	31722	_cf7_2_post-type	formulaire-de-contact-1
    642704	31722	_cf7_2_post-version	2.0.0
    642705	31722	_cf7_2_post-taxonomy	a:0:{}
    642706	31722	_cf7_2_post-map	publish
    Plugin Author Aurovrata Venet

    (@aurovrata)

    vous etes francais? ??

    Here are the values you asked :

    thanks, nothing odd here.

    Both, the fatal error appears without any action, on front-end and in admin.

    I checked again and realise there is some other ways the offending code can be reached…. updated in v5.4.3beta3. Would you please give it another try?

    If this update still bugs, can you please enable the plugin debug mode in your wp-config.php file,

    define('WP_DEBUG', true);
     define('WP_GURUS_DEBUG', true);
     if ( WP_DEBUG ) {
         define( 'WP_DEBUG_LOG', true );
         define( 'WP_DEBUG_DISPLAY', false );
         @ini_set( 'display_errors', 0 );
         define('AUTOSAVE_INTERVAL', 600 );  //seconds
     }

    and place the following line,

    
    debug_msg('mapper called ', '', true);
    

    at the start of the get_post_mapper() method (line 106 in file includes/class-cf7-2-post-factory.php),

    
    public function get_post_mapper( $cf7_post_id ){
      debug_msg('mapper called ', '', true);
      ...
    

    this will print the call stack in your wp-content/debug.log file to see where the method is being called from. Please report the stack print out here.

    Thread Starter flx0

    (@flx0)

    Oui !

    I still have the same error so I did as you said, here is the debug msg from the logs :

    [24-Nov-2021 12:59:56 UTC] PHP Notice:  Undefined offset: 11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:56 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:56 UTC] PHP Notice:  Undefined offset: 11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:56 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:56 UTC] DEBUG_MSG: 
       []->/
       [10]->//home/public_html/cra2021/wp-admin/plugins.php
       [34]->//home/public_html/cra2021/wp-admin/admin.php
       [50]->//home/public_html/cra2021/wp-load.php
       [111]->//home/public_html/cra2021/wp-config.php
       [578]->//home/public_html/cra2021/wp-settings.php
       [470]->//home/public_html/cra2021/wp-includes/plugin.php
       [327]->//home/public_html/cra2021/wp-includes/class-wp-hook.php
       [303]->//home/public_html/cra2021/wp-includes/class-wp-hook.php
       [429]->//home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/admin/class-cf7-2-post-admin.php
       [430]->//home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php
       [107]./class-cf7-2-post-factory.php
              + mapper called 
    [24-Nov-2021 12:59:56 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load_post_mapping() on null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php:150
    Stack trace:
    #0 /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php(430): CF72Post_Mapping_Factory->get_post_mapper(31722)
    #1 /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/admin/class-cf7-2-post-admin.php(429): CF72Post_Mapping_Factory->register_cf7_post_maps()
    #2 /home/public_html/cra2021/wp-includes/class-wp-hook.php(303): Cf7_2_Post_Admin->register_dynamic_posts('')
    #3 /home/public_html/cra2021/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #4 /home/public_html/cra2021/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #5 /home/public_html/cra2021/wp-settings.php(578): do_action('init')
    #6 /home/public_html/cra2021/wp-config.php(11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php on line 150
    [24-Nov-2021 12:59:57 UTC] PHP Notice:  Undefined offset: 11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:57 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:57 UTC] PHP Notice:  Undefined offset: 11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:57 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/wordpress-gurus-debug-api.php on line 28
    [24-Nov-2021 12:59:57 UTC] DEBUG_MSG: 
       []->/
       [17]->//home/public_html/cra2021/index.php
       [13]->//home/public_html/cra2021/wp-blog-header.php
       [50]->//home/public_html/cra2021/wp-load.php
       [111]->//home/public_html/cra2021/wp-config.php
       [578]->//home/public_html/cra2021/wp-settings.php
       [470]->//home/public_html/cra2021/wp-includes/plugin.php
       [327]->//home/public_html/cra2021/wp-includes/class-wp-hook.php
       [303]->//home/public_html/cra2021/wp-includes/class-wp-hook.php
       [429]->//home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/admin/class-cf7-2-post-admin.php
       [430]->//home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php
       [107]./class-cf7-2-post-factory.php
              + mapper called 
    [24-Nov-2021 12:59:57 UTC] PHP Fatal error:  Uncaught Error: Call to a member function load_post_mapping() on null in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php:150
    Stack trace:
    #0 /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php(430): CF72Post_Mapping_Factory->get_post_mapper(31722)
    #1 /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/admin/class-cf7-2-post-admin.php(429): CF72Post_Mapping_Factory->register_cf7_post_maps()
    #2 /home/public_html/cra2021/wp-includes/class-wp-hook.php(303): Cf7_2_Post_Admin->register_dynamic_posts('')
    #3 /home/public_html/cra2021/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    #4 /home/public_html/cra2021/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    #5 /home/public_html/cra2021/wp-settings.php(578): do_action('init')
    #6 /home/public_html/cra2021/wp-config.php(11 in /home/public_html/cra2021/wp-content/plugins/post-my-cf7-form/includes/class-cf7-2-post-factory.php on line 150
    • This reply was modified 3 years, 3 months ago by flx0.
    Plugin Author Aurovrata Venet

    (@aurovrata)

    merci. Je vois ou est le probleme! J’ai fais une mise a jour v5.4.3beta4

    please give it a try.

    Thread Starter flx0

    (@flx0)

    Hello,

    The fatal error is gone ! ??

    There was just a small typo in cf7-post-admin-table.php / line 477 :

    CF7SG_WP_Post_Table not found, I replaced it with Cf7_WP_Post_Table and the UI loaded fine.

    I also found some javascript errors while clicking on “Click to copy” :

    “Clipboard is not defined”

    Plugin Author Aurovrata Venet

    (@aurovrata)

    The fatal error is gone

    great!

    CF7SG_WP_Post_Table not found, I replaced it with Cf7_WP_Post_Table and the UI loaded fine.

    thanks, will fix this too.

    I also found some javascript errors while clicking on “Click to copy”

    ah yes, I can see why. Will remedy this too.

    v5.4.3 is now live

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘5.4.1 Update error’ is closed to new replies.