Priority Support

If you’re a Pro user, please open a support ticket.

Notifications
Clear all

[Solved] Warning: Trying to access array offset on value of type null

Posts: 4
Topic starter
(@oneday)
Active Member
Joined: 1 year ago

Hello, a user of your plugin has asked me to work on a redesign of their site. Ultimate blocks seems to be essential for them, but when switching to php 8.1 an error appears on all pages where an Ultimate Block is inserted.
The error says “Warning: Trying to access array offset on value of type null”
The client has a certification, they are obliged to be either in php 8.1 or 8.2, you can’t switch back to 8.0, and it seems to me that the error would come from there.
Has anyone ever had this type of problem?
The console doesn’t give me an error.

URL is here : https://blog2.talkspirit.com/pourquoi-comment-mettre-en-place-demarche-rse-organisation/

Complete message : ” Warning: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/ultimate-blocks/src/blocks/table-of-contents/block.php on line 17 Warning: Undefined array key -1 in /var/www/html/wp-content/plugins/ultimate-blocks/src/blocks/table-of-contents/block.php on line 17″

6 Replies
Posts: 127
Admin
(@imtiazrayhan23)
Member
Joined: 6 years ago

Hi,

I just tried to recreate the issue on my end with PHP 8.1. 

It seems to be working fine on my end. 

Can you please share some more information?

The issue is coming from Table of Contents block. Can you please edit the post and see if the table of contents is loading fine on the editor?

Also, please try one more thing. Remove the old table of contents block and insert a new, and see if it works or still the same.

Please let me know. I will look further into it once I get the information from you.

Kind regards.

Reply
Posts: 4
Topic starter
(@oneday)
Active Member
Joined: 1 year ago

 i have patched this line :

return $allowedHeaders[$linkArray[$index][‘level’] – 1] && (!array_key_exists(“disabled”, $linkArray[$index]) || (array_key_exists(“disabled”, $linkArray[$index]) && !$linkArray[$index][‘disabled’]));

by this but there stay just one error :
return ($allowedHeaders[$linkArray[$index][‘level’] – 1] ?? false) && (!array_key_exists(“disabled”, $linkArray[$index]) || (!$linkArray[$index][‘disabled’] ?? false));

 

What do you mean by remove the old and insert an new ? i am just a technical operator, it’s writer and marketing team who use Ultimate blocks

Thanks !

 

Reply
Posts: 4
Topic starter
(@oneday)
Active Member
Joined: 1 year ago

the last warning :
Warning: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/ultimate-blocks/src/blocks/table-of-contents/block.php on line 17

 

Reply
Posts: 127
Admin
(@imtiazrayhan23)
Member
Joined: 6 years ago

I meant to edit the one of the posts, remove the table of contents block and add it back again.

Cause even though some of the warnings went away, the block is still not loading properly. So, my guess it something else might be causing it.

In that case, please let me know if it will be possible to give me a temporary access in the site, so that I can look into the issue directly.

If that’s possible, please create an user with our email address support@ultimateblocks.com.

Kind regards.

Reply
Page 1 / 2

Get the Best Blocks Plugin at 20% OFF!

X
Need help?