option-tree icon indicating copy to clipboard operation
option-tree copied to clipboard

PHP 7.4 - Trying to access array offset on value of type bool

Open landbryo opened this issue 4 years ago • 5 comments

I was getting a bunch of notices that I couldn't ignore. Looked into this notice a bit and it appears to be related to some changes in PHP 7.4. It should be a relatively easy fix that I'll go ahead and look into resolving.

( ! ) Notice: Trying to access array offset on value of type bool in option-tree\includes\class-ot-settings.php on line 395

Call Stack
#	Time	Memory	Function	Location
1	0.0002	363080	{main}( )	...\admin.php:0
2	3.4280	14123000	do_action( )	...\admin.php:170
3	3.4281	14123272	WP_Hook->do_action( )	...\plugin.php:478
4	3.4281	14123272	WP_Hook->apply_filters( )	...\class-wp-hook.php:312
5	5.4509	16605920	OT_Settings->add_sections( )	...\class-wp-hook.php:288

landbryo avatar Mar 05 '20 06:03 landbryo

Hi @landbryo

use Null Coalescing Operator ?? maybe? https://stackoverflow.com/questions/59674903/trying-to-access-array-offset-on-value-of-type-bool-in-php-7-4

thanks J

[update: sorry I see you've added a fix.. will this be deployed to the wordpress plugin repo at some point?)

codemonkeynorth avatar Jan 18 '21 15:01 codemonkeynorth

@codemonkeynorth that would be a question for @valendesigns since he was going to review and potentially merge the fix.

landbryo avatar Jan 18 '21 15:01 landbryo

Thanks @landbryo, I implemented your change to my code and I'm not getting the notice anymore!

fellipeleao avatar Nov 19 '21 15:11 fellipeleao

Sorry, I'm confused. What was the fix? I'm getting the same error.

crudoy avatar Jun 19 '23 22:06 crudoy

@crudoy you can view the proposed fix here, but it hasn't been merged yet, so you'd have to manually apply it.

landbryo avatar Jun 20 '23 13:06 landbryo