option-tree
option-tree copied to clipboard
PHP 7.4 - Trying to access array offset on value of type bool
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
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 that would be a question for @valendesigns since he was going to review and potentially merge the fix.
Thanks @landbryo, I implemented your change to my code and I'm not getting the notice anymore!
Sorry, I'm confused. What was the fix? I'm getting the same error.
@crudoy you can view the proposed fix here, but it hasn't been merged yet, so you'd have to manually apply it.