Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#36403 closed defect (bug) (fixed)

Incorrect use of E_USER_NOTICE in wpdb::_real_escape()

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: andizer's profile andizer
Milestone: 4.6 Priority: normal
Severity: normal Version: 3.6
Component: Database Keywords: good-first-bug has-patch
Focuses: Cc:


in wpdb::_real_escape(), the last parameter for _doing_it_wrong() calls is E_USER_NOTICE, which leads to the following message:

wpdb must set a database connection for use with escaping. This message was added in version 1024.

It was apparently influenced by trigger_error(). For _doing_it_wrong(), however, the last parameter should be the version of WordPress where the message was added, i.e. '3.6'.

Introduced in [24758].

Attachments (2)

36403.diff (1.3 KB) - added by andizer 8 years ago.
36403-revision.diff (1.2 KB) - added by andizer 8 years ago.
Update patch

Download all attachments as: .zip

Change History (8)

8 years ago

#1 @andizer
8 years ago

  • Keywords has-patch added; needs-patch removed

Just added a patch for this.

#2 @pento
8 years ago

  • Keywords needs-refresh added

Thanks for the patch, @andizer! It shouldn't be $wp_version, we need to pass the WordPress version where this error message was introduced - in this case, version 3.6.

#3 @andizer
8 years ago

Thank you for your comment. Now I understand. I've updated the patch.

Version 0, edited 8 years ago by andizer (next)

8 years ago

Update patch

#4 @DrewAPicture
8 years ago

  • Owner set to andizer
  • Status changed from new to assigned

Assigning to mark the good-first-bug as "claimed".

#5 @SergeyBiryukov
8 years ago

  • Keywords needs-refresh removed
  • Milestone changed from Awaiting Review to 4.6

#6 @SergeyBiryukov
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38133:

Database: Replace incorrect use of E_USER_NOTICE in wpdb::_real_escape() with the version number where the message was added.

Props andizer.
Fixes #36403.

Note: See TracTickets for help on using tickets.