Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#36403 closed defect (bug) (fixed)

Incorrect use of E_USER_NOTICE in wpdb::_real_escape()

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

Description

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 10 years ago.
36403-revision.diff (1.2 KB ) - added by andizer 10 years ago.
Update patch

Download all attachments as: .zip

Change History (8)

@andizer
10 years ago

#1 @andizer
10 years ago

  • Keywords has-patch added; needs-patch removed

Just added a patch for this.

#2 @pento
10 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
10 years ago

Thank you for your comment. I was too quick in writing the patch, should have read the issue better. I've updated the patch.

Last edited 10 years ago by andizer (previous) (diff)

@andizer
10 years ago

Update patch

#4 @DrewAPicture
10 years ago

  • Owner set to andizer
  • Status newassigned

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

#5 @SergeyBiryukov
10 years ago

  • Keywords needs-refresh removed
  • Milestone Awaiting Review4.6

#6 @SergeyBiryukov
10 years ago

  • Resolutionfixed
  • Status assignedclosed

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.