• Using WP 6.3.2. and NGG 3.55 on PHP 8.2

    When displaying an album of albums incl. their descriptions the following 2 PHP warning are written to the PHP error log:

    PHP Warning: Undefined property: Imagely\NGG\Display\ViewElement::$_list in /wordpress/wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php on line 57
    PHP Warning: foreach() argument must be of type array|object, null given in /wordpress/wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php on line 57

    Line 57 is the one beggining with “foreach ( $container->_list as $ndx => $item )” and something seems to be wrong with the _list

        // Enable album descriptions.
        if ( $this->are_descriptions_enabled( $ds ) ) {
            $description = $this->generate_description( $displayed_gallery );
    
            foreach ( $root_element->find( 'nextgen_gallery.gallery_container', true ) as $container ) {
                // Determine where (to be compatible with breadcrumbs) in the container to insert.
                $pos = 0;
                foreach ( $container->_list as $ndx => $item ) {
                    if ( is_string( $item ) ) {
                        $pos = $ndx;
                    } else {
                        break;
                    }
                }
    
                $container->insert( $description, $pos );
            }
        }
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @sarapatricia,

    Could you please let us know if you use a custom template, and perhaps have removed the $this->start_element() and $this->end_element() calls

    Thread Starter Sara Patricia

    (@sarapatricia)

    Thanks for your reply, @mihaiimagely.

    I do NOT use a custom theme and I did NOT remove any of these calls.

    Thread Starter Sara Patricia

    (@sarapatricia)

    In case you don’t see this warning you may need to turn on PHP error logging in your php.ini file, e. g. like this:

    ; Set the error reporting level.
    error_reporting=E_ALL|E_STRICT
    ; Whether errors should be logged to file.
    log_errors=on
    ; Name of the file where errors should be logged.
    error_log=php-error.log
    ; Whether errors should be printed to the screen.
    display_errors=off

    Thread Starter Sara Patricia

    (@sarapatricia)

    Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @sarapatricia,

    Could you please update to NextGen Gallery 3.57 then let me know if that’ll fix the warning referring to the undefined property?

    Thread Starter Sara Patricia

    (@sarapatricia)

    Thanks for your reply. Unfortunately the exactly same PHP warnings still occur even after upgrading to NGG 3.57.

    [12-Jan-2024 12:00:20 UTC] PHP Warning: Undefined property: Imagely\NGG\Display\ViewElement::$_list in /wordpress/wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php on line 117
    [12-Jan-2024 12:00:20 UTC] PHP Warning: foreach() argument must be of type array|object, null given in /wordpress/wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php on line 117

    What has changed is the position of the affected code in that file so that the warnings now refer to line 117, but this is still the exactly same code!

    foreach ( $container->_list as $ndx => $item ) {

    Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @sarapatricia,

    Thank you for the reply, and sorry for assuming that it has been fixed.

    Our developers are tracking this warning alongside a few others, and they’ll have them all fixed.

    Thread Starter Sara Patricia

    (@sarapatricia)

    Even with NGG 3.58 this issue is NOT resolved at all. It is still caused by /wordpress/wp-content/plugins/nextgen-gallery/src/DisplayTypes/Albums/SharedController.php on line 117.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PHP Warning ‘Undefined property’ when displaying albums incl. descriptions’ is closed to new replies.