Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#15824 closed defect (bug) (fixed)

Introduce _doing_it_wrong to mark places where plugins / themes are calling functions incorrectly

Reported by: westi Owned by: westi
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Warnings/Notices Keywords:
Focuses: Cc:


We are starting to mark incorrect usage of functions with _deprecated_function where as we should have a specific way of marking these so the message is correct as we are not deprecating something but telling people the code they have written won't work

Change History (17)

#1 @westi
5 years ago

Example: Notice: register_uninstall_hook was called with an argument that is deprecated since version 3.1! Only a static class method or function can be used in an uninstall hook.

#2 @nacin
5 years ago

That's the only one I can really think of so far.

In the pipeline, there's #14729 and #11526. #14729 is still on the 3.1 milestone and that one sounds good.

I'll be incorporating this into my Log Deprecated Notices plugin. Please make it easy to backtrace ;-)

#3 @westi
5 years ago

(In [16939]) Introduce _doing_it_wrong(). See #15824.

#4 @westi
5 years ago

(In [16940]) Switch to _doing_it_wrong(). See #15824

#5 @westi
5 years ago

Not sure if there are any other places we are using _deprecated_argument when we should be using this.

#6 @nacin
5 years ago

Just checked them all. We could really use a _deprecated_message() function for a few cases where we've overloaded _deprecated_argument(), but all are indeed deprecated instances of arguments or something.

#7 @westi
5 years ago

(In [16942]) Better message text to reflect that it might not just be an incorrect argument but maybe your calling something way too early. See #15824

#8 @nacin
5 years ago

(In [16945]) Move _doing_it_wrong to other debug functions. Modify docs and the output message. see #15824.

#9 @nacin
5 years ago

(In [16946]) Grammar and spelling. see #15824.

#10 @nacin
5 years ago

(In [16947]) You are doing it wrong in query.php. see #15824, see #14729.

#11 @nacin
5 years ago

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

#12 @ChristianKopp
5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#13 @ChristianKopp
5 years ago

sorry for reopen this ticket.

getting this message in the dashboard after updating to the latest trunk (from yesterday)

Warning: Missing argument 3 for _doing_it_wrong(), called in /wp-includes/plugin.php on line 663 and defined in /wp-includes/functions.php on line 3404

have you all a great xmas time

#14 @nacin
5 years ago

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

(In [16955]) _doing_it_wrong takes three arguments. fixes #15824.

#15 @nacin
5 years ago

You should figure out which plugin is doing it wrong, because one of them is :-)

It'll look like this:

register_uninstall_hook( __FILE__, array( &$this, 'some_method' );

#16 @filosofo
5 years ago

Great. Now you're going to have to make a _doing_doing_it_wrong_wrong function.

Note: See TracTickets for help on using tickets.