Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#57482 closed defect (bug) (fixed)

Remove the Unused variables in the wp-includes folder.

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

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 4 years ago.
57482.2.patch (1.4 KB ) - added by upadalavipul 3 years ago.
57482.3.patch (412 bytes ) - added by upadalavipul 3 years ago.

Download all attachments as: .zip

Change History (8)

@upadalavipul
4 years ago

#1 @dingo_d
4 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
4 years ago

  • Focuses coding-standards added
  • Version trunk

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
3 years ago

  • Milestone Awaiting Review6.3
  • Owner set to SergeyBiryukov
  • Status newaccepted

#4 @SergeyBiryukov
3 years ago

  • Resolutionfixed
  • Status acceptedclosed

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
3 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.