Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44585 closed defect (bug) (fixed)

Docs: $wpdb->prepare should point to $wpdb->esc_like method

Reported by: felipeelia's profile felipeelia Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: normal Version:
Component: Database Keywords: good-first-bug has-patch needs-testing
Focuses: docs Cc:

Description

There is a broken link into $wpdb->prepare() docs: it points to https://developer.wordpress.org/reference/functions/esc_like where it should point to https://developer.wordpress.org/reference/classes/wpdb/esc_like/.

I'm not sure, but I guess it's generated from inline docs, and should be solved simply changing {@see esc_like()} to {@see wpdb::esc_like()} in this line.

Attachments (2)

44585.diff (771 bytes) - added by mbelchev 6 years ago.
44585.2.diff (764 bytes) - added by mbelchev 6 years ago.

Download all attachments as: .zip

Change History (10)

#1 @mbelchev
6 years ago

  • Keywords 2nd-opinion added; needs-patch removed
  • Resolution set to worksforme
  • Status changed from new to closed

Hey @felipeelia, if you're talking about the link to wpdb::esc_like on this page - https://developer.wordpress.org/reference/classes/wpdb/prepare/ (http://prntscr.com/lmor6f), it works for me.

It redirects me to the correct link which you've mentioned in the ticket description. But seems like the inline docs isn't changed.

Probably, we need another confirmation or correct me if I'm talking for something else.

#2 @ocean90
6 years ago

  • Focuses docs added
  • Keywords needs-patch good-first-bug added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to Future Release
  • Resolution worksforme deleted
  • Status changed from closed to reopened

The @see tag should only be used for filters. To fix the linking {@see esc_like()} should get replaced with wpdb::esc_like().

@mbelchev
6 years ago

#3 @mbelchev
6 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Thank you for the clarification, @ocean90! Appreciate your help and I just applied a patch for this change.

#4 @ocean90
6 years ago

  • Keywords needs-refresh added; needs-testing removed

@mbelchev Thanks for the patch! Can you remove the @see part too? It really only needs to be wpdb::esc_like(), the autolinking is handled automatically on developer.w.org.

@mbelchev
6 years ago

#5 @mbelchev
6 years ago

  • Keywords needs-testing added; needs-refresh removed

#6 @johannadevos
6 years ago

It seems that while you guys were working on this ticket, a duplicate ticket was created. In that ticket (#45204), a patch was accepted and implemented in WordPress's code base. That patch happened to be identical to the first patch in the current ticket (#44585), namely 44585.diff.

However, @ocean90 has pointed out that this patch is inadequate. As a result, @mbelchev proposed a second patch (44585.2.diff), which is the one that we want.

Because the inadequate patch has already been implemented in the WordPress code base in the mean time, the 44585.2.diff patch no longer applies. Therefore, a new patch should be created to implement @ocean90's solution as applied to the current version of the code base.

Last edited 6 years ago by johannadevos (previous) (diff)

#7 @SergeyBiryukov
6 years ago

  • Milestone changed from Future Release to 5.2

#8 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from reopened to closed

In 44901:

Docs: Remove unnecessary @see tag in wpdb::prepare().

The tag is only necessary for hooks. For functions and methods, autolinking is handled automatically on developer.wordpress.org.

Props mbelchev, ocean90, johannadevos.
Fixes #44585. See #45204.

Note: See TracTickets for help on using tickets.