#51084 closed defect (bug) (fixed)
„Trying to access array offset on value of type bool“ in "/wp-admin/includes/class-wp-privacy-policy-content.php on line 96 & 97“
Reported by: | treibstoff | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Privacy | Keywords: | needs-privacy-review |
Focuses: | administration | Cc: |
Description
Using WP 5.5 and PHP 7.4 producing masses of following Notice & Warnings on the Admin-Area (only):
Notice: Trying to access array offset on value of type bool in /homepages/…/wp-admin/includes/class-wp-privacy-policy-content.php on line 96
Notice: Trying to access array offset on value of type bool in /homepages/…/wp-admin/includes/class-wp-privacy-policy-content.php on line 97
Warning: Cannot modify header information – headers already sent by (output started at /homepages/…/wp-admin/includes/class-wp-privacy-policy-content.php:96) in /homepages/../wp-admin/admin-header.php on line 9
Line 96 & 97 says:
‘plugin_name’ => $data[‘plugin_name’],
‘policy_text’ => $data[‘policy_text’],
testing without plugins & without my functions in functions.php. Also testing with Standart-Theme. No chance.
The Warnings follwing the Notices....
Change History (8)
#2
@
4 years ago
- Component changed from General to Privacy
- Focuses privacy added
- Keywords needs-privacy-review added
Don't mind me, just adding this to the privacy workflows.
This ticket was mentioned in Slack in #core-privacy by carike. View the logs.
4 years ago
#4
@
4 years ago
this is from an older ticket:
„PHP 7.4 introduces a „Trying to access array offset on value of type …“ warning for accessing null/bool/int/float/resource (everything but array, string and object) as if it were an array.“
and
„I expect more issues to be reported – both in Core as well as in plugins and themes – once PHP 7.4 is out and starting to be used for real.“
#5
follow-up:
↓ 7
@
4 years ago
- Milestone changed from Awaiting Review to 5.6
- Owner set to SergeyBiryukov
- Status changed from new to accepted
Hi there, welcome back to WordPress Trac! Thanks for the report.
Just noting that I could not reproduce the issue on a clean install, but it looks like this can happen when the _wp_suggested_privacy_policy_content
meta value for the Privacy Policy page is somehow corrupted.
I think adding an is_array()
check before accessing the $data['plugin_name']
and $data['policy_text']
values would make sense.
#7
in reply to:
↑ 5
@
4 years ago
Replying to SergeyBiryukov:
Hi there, welcome back to WordPress Trac! Thanks for the report.
Just noting that I could not reproduce the issue on a clean install, but it looks like this can happen when the
_wp_suggested_privacy_policy_content
meta value for the Privacy Policy page is somehow corrupted.
I think adding an
is_array()
check before accessing the$data['plugin_name']
and$data['policy_text']
values would make sense.
thanx @SergeyBiryukov, this solution works.
hope it will stay with the next update of class-wp-privacy-policy-content.php
This does not happen with PHP 7.3, as I just realized.