WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37744 closed defect (bug) (fixed)

wpdb::prepare PHPDoc recommends bad PHP

Reported by: TJNowell Owned by: SergeyBiryukov
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.3
Component: Database Keywords: has-patch
Focuses: docs Cc:

Description

The phpdoc of the prepare method recommends calling it statically via the examples. Doing this would cause PHP warnings and notices.

I've attached a diff that should correct this by changing wpdb::prepare to $wpdb->prepare

Attachments (1)

wpdb.diff (740 bytes) - added by TJNowell 3 years ago.
A diff to be applied to wp-db.php that adjusts the phpdocs of wpdb::prepare

Download all attachments as: .zip

Change History (4)

@TJNowell
3 years ago

A diff to be applied to wp-db.php that adjusts the phpdocs of wpdb::prepare

#1 @pento
3 years ago

  • Milestone changed from Awaiting Review to 4.7

Good catch, thanks @TJNowell!

#2 @Presskopp
3 years ago

  • Keywords has-patch added

#3 @SergeyBiryukov
3 years ago

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

In 38289:

Docs: Correct usage examples for wpdb::prepare(), which should not be called statically.

Props TJNowell.
Fixes #37744.

Note: See TracTickets for help on using tickets.