Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#25116 closed defect (bug) (fixed)

edit_tag_link() calls edit_term_link() with params out of order

Reported by: pbiron Owned by: SergeyBiryukov
Priority: normal Milestone: 3.7
Component: Template Version: 3.1
Severity: normal Keywords: has-patch needs-testing
Cc: Focuses:

Description

I think edit_tag_link() calls edit_term_link() with parameters out of order.

On ​line 669, edit_tag_link() calls edit_term_link() like so

$link = edit_term_link( $link, '', '', false, $tag );

but I believe that call should have the last 2 params reversed, as in

$link = edit_term_link( $link, '', '', $tag, false );

since the signature for edit_term_link() is (on ​line 715)

edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true )

(i.e., with the term/tag as the 4th param and the boolean echo as the 5th).

Can anyone else verify that this is, indeed, a bug? I believe it is since calling edit_tag_link() as is results in the following error messages:

Notice: Trying to get property of non-object in \wp-includes\link-template.php on line 720
Notice: Trying to get property of non-object in \wp-includes\link-template.php on line 721
Notice: Trying to get property of non-object in \wp-includes\link-template.php on line 721

but reversing the order of the last 2 params in the call to edit_term_link() results in the expected output (and no error messages).

As far as I can tell, this bug has existed since ​v3.1.

Attachments (1)

link-templates.php.diff​ (532 bytes ) - added by pbiron 13 years ago.
patch to \wp-includes\link-templates.php

Download all attachments as: .zip

Change History (4)

@pbiron
13 years ago

patch to \wp-includes\link-templates.php

#1 @SergeyBiryukov
13 years ago

  • Keywords 2nd-opinion removed
  • Milestone Awaiting Review → 3.7
  • Version 3.6 → 3.1

Introduced in [15792].

#2 @SergeyBiryukov
13 years ago

edit_tag_link() description also says that $tag can be a tag object or ID, however it's directly passed to edit_term_link(), which only accepts an object.

#3 @SergeyBiryukov
13 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 25079:

Use correct order of arguments when calling edit_term_link() from edit_tag_link(). Correct $tag parameter description. props pbiron. fixes #25116.

Note: See TracTickets for help on using tickets.