Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#25116 closed defect (bug) (fixed)

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

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

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 11 years ago.
patch to \wp-includes\link-templates.php

Download all attachments as: .zip

Change History (4)

@pbiron
11 years ago

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

#1 @SergeyBiryukov
11 years ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Awaiting Review to 3.7
  • Version changed from 3.6 to 3.1

Introduced in [15792].

#2 @SergeyBiryukov
11 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
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to 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.