Make WordPress Core

Opened 22 months ago

Closed 17 months ago

Last modified 16 months ago

#44708 closed defect (bug) (fixed)

Coding consistency, seeing both $request and $request_data

Reported by: garrett-eclipse Owned by: desrosj
Milestone: 5.1 Priority: normal
Severity: minor Version: 4.9.6
Component: Privacy Keywords: good-first-bug has-patch
Focuses: Cc:



I'm noticing the variable naming for Privacy component items isn't consistent as there's a mix of both $request and $request_data for the request object. IMHO $request makes the most sense.

You can see this inconsistency best when you search for the 'wp_get_user_request_data' function call;

$request_data is used in wp-includes/user.php and once in wp-admin/includes/user.php, but $request is found in wp-admin/includes/user.php, wp-admin/includes/file.php and /wp-admin/includes/ajax-actions.php


Attachments (2)

44708.patch (5.1 KB) - added by nateallen 22 months ago.
Changes variables named $request_data to $request for consistency
44708.diff (6.4 KB) - added by bruceallen 20 months ago.

Download all attachments as: .zip

Change History (14)

#1 @desrosj
22 months ago

  • Keywords needs-patch added
  • Severity changed from normal to minor

#2 @desrosj
22 months ago

  • Focuses privacy coding-standards removed
  • Keywords good-first-bug added

22 months ago

Changes variables named $request_data to $request for consistency

#3 @nateallen
22 months ago

  • Keywords has-patch added; needs-patch removed

20 months ago

#4 @pento
20 months ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to pento
  • Status changed from new to reviewing

#5 @bruceallen
20 months ago

Tested original patch and it looks good in terms of replacing the variables. Doing further testing on functionality.

Last edited 20 months ago by bruceallen (previous) (diff)

#6 @pento
20 months ago

  • Status changed from reviewing to accepted

#7 @pento
20 months ago

  • Owner pento deleted
  • Status changed from accepted to assigned

#8 @garrett-eclipse
20 months ago

@pento the 44708.diff from @bruceallen seems to have gotten some unrelated css in list-tables.css that shouldn't be there. Aside from that the other changes are identical to 44708.patch from @nateallen so would use that version for the commit.

#9 @pento
20 months ago

  • Milestone changed from 5.0 to 5.1

This ticket was mentioned in Slack in #core-privacy by desrosj. View the logs.

17 months ago

#11 @desrosj
17 months ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from assigned to closed

In 44606:

Privacy: Use consistent variable naming when working with privacy requests.

Throughout the core privacy functions, WP_User_Request instances were stored in variables named both $request, and $request_data. This changes all occurrences of $request_data to $request for better consistency.

Props nateallen, bruceallen, garrett-eclipse.
Fixes #44708.

#12 @garrett-eclipse
16 months ago

I've opened #46302 as I found more instances of $request_data. And am also wondering if wp_get_user_request_data shouldn't just be wp_get_user_request as it returns the WP_User_Request object.

Note: See TracTickets for help on using tickets.