WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 3 months ago

#44585 closed defect (bug) (fixed)

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

Reported by: felipeelia Owned by: 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 months ago.
44585.2.diff (764 bytes) - added by mbelchev 6 months ago.

Download all attachments as: .zip

Change History (10)

#1 @mbelchev
7 months 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 months 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 months ago

#3 @mbelchev
6 months 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 months 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 months ago

#5 @mbelchev
6 months ago

  • Keywords needs-testing added; needs-refresh removed

#6 @johannadevos
3 months 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 3 months ago by johannadevos (previous) (diff)

#7 @SergeyBiryukov
3 months ago

  • Milestone changed from Future Release to 5.2

#8 @SergeyBiryukov
3 months 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.