Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#57482 closed defect (bug) (fixed)

Remove the Unused variables in the wp-includes folder.

Reported by: upadalavipul's profile upadalavipul Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.3 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: coding-standards Cc:

Description

I have reviewed the code and found Unused variables in some of the below files. Please below files:

Files:


  1. /wp-includes/SimplePie/Item.php
  2. /wp-includes/SimplePie/Locator.php
  3. /wp-includes/class-wp-comment-query.php
  4. /wp-includes/feed-atom.php

Attachments (3)

57482.patch (3.8 KB) - added by upadalavipul 2 years ago.
57482.2.patch (1.4 KB) - added by upadalavipul 2 years ago.
57482.3.patch (412 bytes) - added by upadalavipul 22 months ago.

Download all attachments as: .zip

Change History (8)

@upadalavipul
2 years ago

#1 @dingo_d
2 years ago

  • Focuses coding-standards removed

Isn't SimplePie a bundled lib for RSS? Not sure, but maybe this should be fixed upstream?

Also, in the Locator.php, you have just commented the lines out, if things are not used, then it's better that they are removed (they are all versioned files, so the change can always be reverted).

For the $more variable, I'm not sure it's unused (all the other feed files have it so it could be used in some way). Also Phpstorm didn't report it as unused for me.

#2 @audrasjb
2 years ago

  • Focuses coding-standards added
  • Version trunk deleted

Hello and thanks for the ticket/patch,

Yes, SimplePie is an external dependency that need to be fixed upstream: https://github.com/simplepie/simplepie

#3 @SergeyBiryukov
2 years ago

  • Milestone changed from Awaiting Review to 6.3
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#4 @SergeyBiryukov
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 55559:

Coding Standards: Remove unused variables in WP_Comment_Query.

  • $unapproved_ids and $unapproved_emails in WP_Comment_Query::get_comment_ids() were added in [29965] and appear to never have been used.
  • $wpdb in WP_Comment_Query::fill_descendants() was replaced with $this->db in [38275], removed in [38446], and accidentally reinstated in [38768].

Follow-up to [29965], [34546], [37625], [38275], [38446], [38768], [44546].

Props upadalavipul, dingo_d, audrasjb, SergeyBiryukov.
Fixes #57482.

#5 @SergeyBiryukov
2 years ago

Re: 57482.2.patch, as noted above, SimplePie is an external library and should not be patched here, any suggested changes to its files should be submitted upstream: https://github.com/simplepie/simplepie.

Note: See TracTickets for help on using tickets.