51423: wp_privacy_process_personal_data_export_page() fixes type match for array_merge (PHP 8)#776
Open
hellofromtonya wants to merge 2 commits intoWordPress:masterfrom
Conversation
Retains the behavior of the meta being passed into the array_merge(), i.e. making it easier for developers to debug.
hellofromtonya
commented
Nov 29, 2020
Comment on lines
+776
to
+781
| wp_send_json_error( | ||
| sprintf( | ||
| 'Warning: array_merge(): Expected parameter 1 to be an array, %1$s given.', | ||
| gettype( $accumulated_data ) | ||
| ) | ||
| ); |
Contributor
Author
There was a problem hiding this comment.
Preserves the original warning when/if '_export_data_raw' exists but is not an array type.
< PHP 7.3
Warning: array_merge(): Argument #1 is not an array
PHP 7.3-7.4
Warning: array_merge(): Expected parameter 1 to be an array, string given
PHP 8
Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, string given
See it in action here https://3v4l.org/3EbKY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trac ticket: https://core.trac.wordpress.org/ticket/51423
Function:
wp_privacy_process_personal_data_export_page()Resolves "Parameter #1 $arr1 of function array_merge expects array, array|bool given."
array_mergeto prevent the PHP 8 fatal error'_export_data_raw'is not an array type. Error is passed via wp_send_json_error. Tests added to validate.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.