• Resolved paparappa

    (@paparappa)


    Hi, I upgraded PHP to 7.4.5 and suddenly i get this error which I haven’t seen before.

    Notice: Trying to access array offset on value of type null in plugins/w3-total-cache/Util_Environment.php on line 187

    I’ve tried to look up a solution online but couldn’t find one. Why is this happening? Has it anything to do with the php version or is it related to something else? Would be really grateful for a response.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @paparappa

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    It appears that your blogs.php file is broken can you please delete the wp-content/cache/blogs.php and see if the issue persists?
    Thank you!

    Thread Starter paparappa

    (@paparappa)

    Hi and thank you for your reply! It seems I don’t have a file called blogs.php in the cache folder. Could that have something to do with the issue?

    Thread Starter paparappa

    (@paparappa)

    I rewrote the line 187 in plugin code that is like this:

    $blog_data = Util_WpmuBlogmap::get_current_blog_data();
    if ( is_null( $blog_data ) )
    	$result = true;
    $result = ( $blog_data[0] == 'm' );

    And rewrote it as follows:

    $blog_data = Util_WpmuBlogmap::get_current_blog_data();
    if ( is_null( $blog_data ) )
    	$result = true;
    if ( !empty( $blog_data ) )
    $result = ( $blog_data[0] == 'm' );

    And now it’s working.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @paparappa

    Thank you for the information.
    Are you using multisite? If so blogs.php should be there.
    Thank you for the solution in this case.

    Thread Starter paparappa

    (@paparappa)

    Yes it is a multisite and I see the blogs.php, must have just looked poorly before now. But i use docker and bitbucket pipelines so every time I build, the cache folder is cleared which would mean that blogs.php is deleted every time I build. However it does look like there’s a problem with those lines of code. To me it doesn’t seem as it handles $blog_data as NULL and maybe that could be the source of the problem.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @paparappa

    Thank you for the information. We are checking this.
    Just a couple more questions. The issue started only when you updated to 7.4.5 PHP?
    You have not experienced any issues before?
    When you say :

    I use docker and bitbucket pipelines so every time I build, the cache folder is cleared which would mean that blogs.php is deleted every time I build

    Is the entire cache folder deleted or the cache is cleared?
    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Trying to access array offset on value of type null’ is closed to new replies.