WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#6906 closed defect (bug) (fixed)

syntax error in _deprecated_function() and _deprecated_file()

Reported by: JonathanRogers Owned by:
Milestone: 2.6 Priority: normal
Severity: minor Version: 2.5.1
Component: General Keywords:
Focuses: Cc:

Description

The functions _deprecated_function() and _deprecated_file() in wp-includes/functions.php contain lines like:

trigger_error( printf( __("%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead."), $function, $version, $replacement ) );

The printf format strings seem to be bogus and cause PHP to complain when I put "define('WP_DEBUG',true);" in my wp-config.php:

[03-May-2008 17:35:17] PHP Notice:  Undefined variable: s in /wordpress_root/wp-includes/functions.php on line 1708

I also see "is deprecated since version ! Use instead." inserted at the top of some pages. I'm quite sure those should be calls to sprintf and should contain correct format strings.

Attachments (1)

wp_deprecated.patch (1.7 KB) - added by JonathanRogers 6 years ago.
Fixes deprecated function and file reporting

Download all attachments as: .zip

Change History (5)

JonathanRogers6 years ago

Fixes deprecated function and file reporting

comment:1 DD326 years ago

wp_deprecated.patch

%1$s Is a valid sprintf statement i believe.

Simply changing the quoting style to this should work:

sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.')

comment:2 westi6 years ago

  • Milestone changed from 2.7 to 2.5.2

%1$s is a valid format string - it allows for the translated string to use the included specifiers in a different order if they want.

However, they should definitely be calls to sprintf so that the return the string to pass to trigger_error and as DD32 suggests that quoting is all wrong.

comment:3 westi6 years ago

  • Milestone changed from 2.5.2 to 2.6

comment:4 westi6 years ago

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

[7884] Fix _deprecated_function() and _deprecated_file() so that they work correctly. Props JonathanRogers and DD32.

Note: See TracTickets for help on using tickets.