Issue Customizer.php

Home Forums Calendar Products Events Calendar PRO Issue Customizer.php

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1219776
    bcitweb
    Participant

    We are running version v 4.4.0.1 of the calendar and 4.0.1 of Pro, and are seeing issues in our error logs:

    PHP Warning: Invalid argument supplied for foreach() in /path/to/blog/wp-content/plugins/the-events-calendar/common/src/Tribe/Customizer.php on line 430′

    The code this refers to is the second foreach loop in the following:

        /**
         * Replaces the Settings using the Underscore templating strings
         *
         * @param  string $template The template variable, that we will look to replace the variables
         * @return string           A Valid css after replacing the variables
         */
        private function parse_css_template( $template ) {
            $css = $template;
            $sections = $this->get_option();
    
            $search = array();
            $replace = array();
            foreach ( $sections as $section => $settings ) {
                foreach ( $settings as $setting => $value ) {
                    $index = array( $section, $setting );
    
                    // Add search based on Underscore template
                    $search[] = '<%= ' . implode( '.', $index ) . ' %>';
    
                    // Get the Replace value
                    $replace[] = $value;
                }
            }
    #1220101
    George
    Participant

    Thanks for reaching out, James!

    I’m not able to reproduce this error on my own sites, but I have logged a bug ticket for our developers to investigate this problem.

    If it’s confirmed to be the case that there’s a bug here, I will update this thread with information about when the bug fix can be expected to arrive.

    Stay tuned!
    George

    #1226437
    bcitweb
    Participant

    Poking around here. Seeing another error when I go to the Appearance->Customize menu:

    Fatal error: Uncaught TypeError: Argument 2 passed to Tribe__Events__Pro__Customizer__Section::register() must be an instance of Tribe__Events__Pro__Customizer__Main, instance of Tribe__Customizer given, called in /srv/pweb/blogs/devel/wordpress/wp-includes/class-wp-hook.php on line 298 and defined in /srv/pweb/blogs/devel/wordpress/wp-content/plugins/events-calendar-pro/src/Tribe/Customizer/Section.php:230 Stack trace: #0 /srv/pweb/blogs/devel/wordpress/wp-includes/class-wp-hook.php(298): Tribe__Events__Pro__Customizer__Section->register(NULL, Object(Tribe__Customizer)) #1 /srv/pweb/blogs/devel/wordpress/wp-includes/plugin.php(203): WP_Hook->apply_filters(NULL, Array) #2 /srv/pweb/blogs/devel/wordpress/wp-content/plugins/the-events-calendar/common/src/Tribe/Customizer.php(487): apply_filters('tribe_events_pr...', NULL, Object(Tribe__Customizer)) #3 /srv/pweb/blogs/devel/wordpress/wp-includes/class-wp-hook.php(298): Tribe__Customizer->register(Object(WP_Customize_Manager)) #4 /srv/pweb/blogs/devel/wordpress/wp-includes/cl in /srv/pweb/blogs/devel/wordpress/wp-content/plugins/events-calendar-pro/src/Tribe/Customizer/Section.php on line 230

    #1226445
    bcitweb
    Participant

    Doing a var_dump on the sections array in the above code like this:

    private function parse_css_template( $template ) {
        $css = $template;
        $sections = $this->get_option();
    var_dump($sections);exit;
    

    Yields the following array structure:

    
    array(7) {
      ["general_theme"]=>
      array(2) {
        ["base_color_scheme"]=>
        string(5) "light"
        ["featured_color_scheme"]=>
        string(7) "default"
      }
      ["global_elements"]=>
      array(0) {
      }
      ["day_list_view"]=>
      array(3) {
        ["price_bg_color"]=>
        string(7) "#eeeeee"
        ["price_border_color"]=>
        string(7) "#c7c7c7"
        ["price_color"]=>
        string(7) "#333333"
      }
      ["month_week_view"]=>
      array(10) {
        ["table_bg_color"]=>
        string(7) "#f9f9f9"
        ["highlight_color"]=>
        string(7) "#21759b"
        ["table_header_bg_color"]=>
        string(7) "#464646"
        ["border_light_color"]=>
        string(7) "#e4e4e4"
        ["border_dark_color"]=>
        string(7) "#d2d2d2"
        ["cell_inactive_bg_color"]=>
        string(7) "#f1f1f1"
        ["cell_inactive_header_bg_color"]=>
        string(7) "#d2d2d2"
        ["cell_header_bg_color"]=>
        string(7) "#acacac"
        ["highlight_color_rgba"]=>
        string(25) "rgba( 33, 117, 155, .75 )"
        ["highlight_border_color"]=>
        string(7) "#14455c"
      }
      ["single_event"]=>
      array(3) {
        ["post_title_color"]=>
        string(4) "#333"
        ["details_bg_color"]=>
        string(7) "#e5e5e5"
        ["details_text_color"]=>
        string(7) "#333333"
      }
      ["widget"]=>
      array(3) {
        ["calendar_header_color"]=>
        string(4) "#999"
        ["calendar_datebar_color"]=>
        string(7) "#e0e0e0"
        ["featured_show_images"]=>
        bool(true)
      }
      ["photo_view"]=>
      NULL
    }
    

    The [“photo_view”]=> NULL piece will generate the original reported error (invalid argument provided to foreach) as NULL is not an array.

    #1226449
    bcitweb
    Participant

    BTW I have updated the calendar plugin to 4.4.1.1

    #1226485
    bcitweb
    Participant

    And we are also running the latest wordpress, 4.7.2

    #1226805
    George
    Participant

    Thanks for reporting this James.

    In your reply above you say, “Poking around here. Seeing another error when I go to the Appearance->Customize menu:” — then you shared a Fatal Error.

    So is it safe to say that you literally cannot use the WordPress Customizer at all on your site? Is it totally broken for you?

    Just curious about how these errors are actually manifesting in your site’s front-end, and how it works (or doesn’t work) for you specifically.

    Thanks,
    George

    #1226965
    bcitweb
    Participant

    That is correct – when I follow the Customize link I get a fatal error. I would have reported that as well but only saw it yesterday when I was taking another look at things.

    We are also a multi-site installation.

    Yesterday I created a new test blog on our network using the twentyseventeen theme. I activated the events calendar and calendar pro plugins to the blog and received the same fatal error when I tried the customize link. I also got the original foreach error when testing the frontend.

    Then I disabled the events calendar pro plugin and did not get the fatal error on customize nor the foreach error when I test the front-end.

    I then re-activated the pro plugin and the errors came back.

    #1226992
    George
    Participant

    Hi James,

    Thanks for these extra details. I admit that I am a bit stumped because I cannot recreate these errors on my own site, but will be reaching out to a developer on our team to assist me in investigating these problems.

    In the meantime, while you mention what plugin versions you are using, can you post your site’s complete and unedited “System Information” to this thread by following the “Sharing information manually” steps in this article? ? https://theeventscalendar.com/knowledgebase/sharing-sys-info/

    That will be very helpful for us as we investigate this.

    Thanks!
    George

    #1227154
    bcitweb
    Participant

    This reply is private.

    #1227860
    George
    Participant

    This reply is private.

    #1228445
    bcitweb
    Participant

    No it is not networked activated.

    #1228689
    George
    Participant

    Thanks James.

    I am sorry about the pace of this investigation but I am utterly stumped because I can’t recreate this, so I am working with other members on our team and will keep you posted on this!

    Stay tuned!

    George

    #1336031
    George
    Participant

    Hey James,

    I wanted to post an update on this because we have devoted serious resources to trying to suss out the exact cause of this bug.

    We have consistently failed to reproduce the bug, and so there is unfortunately no action we can take to fix it. This is a confusing issue and I am very sorry about the lack of a clean resolution on this!

    For now, all we can recommend is to use the latest version of all software on your site, from WordPress Core itself to all of your plugins and your theme. Next, it may be worth doing a “Clean installation” of our plugins on your site, which means the following:

    • Back up your database first. The next steps should not affect any event data at all, but better to have a backup and not need it than need a backup and not have it.
    • Delete — not just deactivated, but delete — The Events Calendar, Events Calendar Pro, and any related plugins from your site.
    • Update your version of WordPress to the latest version if it’s not already there. (Currently, that version is 4.8.1)
    • Download fresh zips of The Events Calendar, Events Calendar Pro, and related plugins from your “Downloads” page here → theeventscalendar.com/my-account/downloads
    • Install those fresh zips on your site, and then activate those plugins.

    We cannot recreate the bugs reported here, and no other folks are reporting them, so the issues may be emerging from your site itself or from conflicting code within our plugin files. The above steps may help address that.

    I wish you the best of luck with your project, and if we hear from more folks about these sorts of bugs, we will certainly reopen the investigation and try again.

    Sincerely,
    George

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Issue Customizer.php’ is closed to new replies.