Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
56df70d
wp-admin/includes/privacy-tools.php: Fix a PHP 8.0 fatal "Parameter #…
xknown Nov 9, 2020
c44e87a
Sends json error when '_export_data_grouped' exists but not array.
hellofromtonya Nov 29, 2020
2ac2209
Removes extra fix to keep this PR focused on one function.
hellofromtonya Nov 29, 2020
f8edbcc
Merge branch 'master' into fix/php8.0/51423-wp-admin/includes/privacy…
hellofromtonya Nov 29, 2020
a1185ff
Adds tests for array_merge warning json error.
hellofromtonya Nov 29, 2020
79ac839
Abstracts setup for export contents to make it easier to add tests.
hellofromtonya Nov 29, 2020
901ff24
Adds tests to validate groups json behavior.
hellofromtonya Nov 29, 2020
00e73a0
Adds tests for json export to validate export data grouped.
hellofromtonya Nov 29, 2020
8ab0d23
Merge branch 'master' into fix/php8.0/51423-wp-admin/includes/privacy…
hellofromtonya Feb 5, 2021
324af66
Adds _doing_it_wrong when meta value exists but is not an array.
Mar 18, 2021
2f242e1
Updates the tests.
Mar 18, 2021
5baeff0
Fixes test naming.
Mar 18, 2021
ef28395
Fixes closing ) placement for __().
Mar 19, 2021
11551b8
Cast to array when not an array.
Mar 19, 2021
ae22009
Skip array_merge when not an array.
Mar 19, 2021
3a9db91
Make json contents test more robust.
Mar 19, 2021
47f7ba0
Remove extra fix (new PR).
Mar 22, 2021
2483915
Sets vars to match current values to ensure same report output results.
Mar 22, 2021
44d9507
Fixes tests.
Mar 22, 2021
11361ca
Adds more test data for invalid type.
Mar 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions src/wp-admin/includes/privacy-tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,6 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
$email_address
);

// And now, all the Groups.
$groups = get_post_meta( $request_id, '_export_data_grouped', true );

// First, build an "About" group on the fly for this report.
$about_group = array(
/* translators: Header for the About section in a personal data export. */
Expand Down Expand Up @@ -388,10 +385,24 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
),
);

// Merge in the special about group.
$groups = array_merge( array( 'about' => $about_group ), $groups );
// And now, all the Groups.
$groups = get_post_meta( $request_id, '_export_data_grouped', true );
if ( is_array( $groups ) ) {
$groups = array_merge( array( 'about' => $about_group ), $groups );
$groups_count = count( $groups );
} else {
if ( false !== $groups ) {
_doing_it_wrong(
__FUNCTION__,
/* translators: %s: post meta key. */
sprintf( __( 'The %s post meta must be an array.' ), "<code>'_export_data_grouped'</code>" ),
'5.8.0'
);
}

$groups_count = count( $groups );
$groups = null;
$groups_count = 0;
}

// Convert the groups to JSON format.
$groups_json = wp_json_encode( $groups );
Expand Down
Loading