• Resolved Ov3rfly

    (@ov3rfly)


    Getting these in a clients debug.log file:

    [21-Oct-2023 07:54:25 UTC] PHP Deprecated:  Automatic conversion of false to array is deprecated in .../wp-content/plugins/menu-icons/vendor/codeinwp/themeisle-sdk/src/Modules/Dashboard_widget.php on line 326

    Reason: $items_normalized is false when it is accessed as array via $items_normalized[] = ...

    Menu Icons 0.13.7, WordPress 6.3.2, PHP 8.1.x

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Stefan Cotitosu

    (@stefancotitosu)

    Hi @ov3rfly,

    Thank you for using Menu Icons.

    I’m not able to replicate the issue with the following specs:

    • WordPress 6.3.2
    • PHP 8.1.23
    • Twenty Twenty-One 1.8

    I’ve added icons with the plugin to the Primary Menu and the WP_DEBUG is enabled, however, there is no error.

    Would it be possible to share the exact steps to replicate it; also, may I ask which theme and version are you using?

    Regards,
    Stefan

    Thread Starter Ov3rfly

    (@ov3rfly)

    See /*** explaination ***/ in code:

    /**
     * Setup feed items.
     */
    private function setup_feeds() {
    	if ( false === ( $items_normalized = get_transient( 'themeisle_sdk_feed_items' ) ) ) { 
    
    /*** $items_normalized is false here ***/
    
    		// Load SimplePie Instance.
    		$feed = fetch_feed( $this->feeds );
    		// TODO report error when is an error loading the feed.
    		if ( is_wp_error( $feed ) ) {
    			return;
    		}
    
    		$items = $feed->get_items( 0, 5 );
    		$items = is_array( $items ) ? $items : [];
    		foreach ( $items as $item ) {
    
    /*** $items_normalized is accessed as array here ***/
    
    			$items_normalized[] = array(
    				'title' => $item->get_title(),
    				'date'  => $item->get_date( 'U' ),
    				'link'  => $item->get_permalink(),
    			);
    		}
    		set_transient( 'themeisle_sdk_feed_items', $items_normalized, 48 * HOUR_IN_SECONDS );
    	}
    	$this->items = $items_normalized;
    }
    Plugin Support AndreeaR

    (@andreearadacina21)

    Hey @ov3rfly,

    Thank you for providing more information.

    To assist you better, could you please share the exact steps you followed when encountering the issue?

    Additionally, we’d appreciate it if you could provide details about the theme you are using, including its version. This information will allow us to replicate the problem more accurately and offer a more effective solution.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Exact steps I followed:

    • Found warning in WordPress debug.log
    • Read your code in Dashboard_widget.php
    • Identified the problem in your code
    • Posted bug report
    • Added explainations to your code in bug report
    • Added exact steps I followed

    The problem is not theme related but a simple bug in your code when transient themeisle_sdk_feed_items does not exist (yet).

    Thread Starter Ov3rfly

    (@ov3rfly)

    Steps to reproduce:

    Use some PHP sandbox (e.g. onlinephp.io) and run this code (which is basically your code) with PHP 8.1.x or 8.2.x (error reporting enabled):

    $items_normalized = false;
    $items_normalized[] = 'whatever';

    The output will be similar to debug.log in initial post because a variable set to false can not be accessed as array. More about autovivification on false can be found in PHP Wiki.

    Plugin Support irinelenache

    (@irinelenache)

    Hello @ov3rfly,

    Thank you for the details provided!

    We appreciate your cooperation in reporting the issue you’re encountering. We are sorry for the inconvenience, and now we have confirmed the problem. A bug report has been created and forwarded to our product development team for review.

    What happens next?

    Our product team will evaluate the impact of this issue compared to other open bugs and upcoming features, and assign a priority level to the bug report. Our developers prioritize the highest-priority issues first, so we cannot provide a specific timeline for resolution at this time.

    Best regards,

    Irinel

    Thread Starter Ov3rfly

    (@ov3rfly)

    Since you keep marking issues as ‘resolved’ again and again while they are not resolved:

    Feel free to mark issues as ‘resolved’ after a plugin update with a bug fix has been released by your development team, not before.

    Thanks.

    Plugin Support irinelenache

    (@irinelenache)

    Hi @ov3rfly,

    Thank you for your message and for bringing this matter to our attention. I apologize for any confusion caused by marking the thread as resolved.

    In our support process, we consider an issue resolved from the support side once it has been documented and reported to our development team for resolution.

    I’m happy to share that a new update was released today, which includes a fix for the issue you’ve been experiencing.

    Thank you for your patience and understanding.

    Plugin Support AndreeaR

    (@andreearadacina21)

    Hey @ov3rfly,

    Thank you for your patience!

    Could you please update the plugin to its latest version and verify if the issue persists on your website?

    Best regards,

    Andreea

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP Deprecated: Automatic conversion of false to array is deprecated’ is closed to new replies.