Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#20953 closed defect (bug) (fixed)

Users with PHP 5.2.4 or lower will receive notice "wrong parameter count for debug_backtrace()"

Reported by: swekitsune's profile swekitsune Owned by: nacin's profile nacin
Milestone: 3.4.1 Priority: normal
Severity: normal Version: 3.4
Component: Warnings/Notices Keywords: has-patch commit
Focuses: Cc:

Description

If you try to update Wordpress to 3.4 on a server using PHP 5.2.4 or lower, the user will receive the notice "wrong parameter count for debug_backtrace()". In the function "wp_debug_backtrace_summary" we can see that the usage of debug_backtrace looks like this:

$trace  = debug_backtrace( false );

In PHP 5.2.4 or lower, debug_backtrace() doesn't accept any parameters – however, laters versions do.

For the time being, it is easily fixed (just remove "false") but a permanent fix should be sought for.

Attachments (1)

20953.patch (836 bytes) - added by kurtpayne 12 years ago.
Use php-version specific options for debug_backtrace()

Download all attachments as: .zip

Change History (8)

#1 @swekitsune
12 years ago

  • Summary changed from function debug_backtrace() doesn't accept any parameters in PHP 5.2.4 or lower to Users with PHP 5.2.4 or lower will receive notice "wrong parameter count for debug_backtrace()"

Changed the title to be more descriptive.

#2 @nacin
12 years ago

This means you are running SAVEQUERIES in production, or are generating queries with errors, which are both bad.

As a "permanent" fix we could A) conditionally call debug_backtrace() with either one or no arguments, and B) if we call it with no arguments, we'll need to ignore the object ourselves.

#3 follow-up: @nacin
12 years ago

  • Milestone changed from Awaiting Review to 3.4.1

I think this actually generates an E_WARNING for PHP core functions, rather than E_NOTICE, so assigning to 3.4.1.

@kurtpayne
12 years ago

Use php-version specific options for debug_backtrace()

#4 in reply to: ↑ 3 @kurtpayne
12 years ago

  • Cc kpayne@… added
  • Keywords has-patch added

Replying to nacin:

I think this actually generates an E_WARNING for PHP core functions, rather than E_NOTICE, so assigning to 3.4.1.

Confirmed E_WARNING. Submitted 20953.patch for the following:

php < 5.2.5 = debug_backtrace
php 5.2.5 to 5.3.5 = debug_backtrace(false)
php 5.3.6+ = debug_backtrace(0)

false vs. 0 is semantics, but 0 emphasizes that it's a bitmask field.

#5 @nacin
12 years ago

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

In [21113]:

Don't call debug_backtrace() with an argument for PHP 5.2.4, which is currently the lowest version we support. props swekitsune, kurtpayne. fixes #20953.

#6 @nacin
12 years ago

  • Keywords commit added
  • Resolution fixed deleted
  • Status changed from closed to reopened

#7 @nacin
12 years ago

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

In [21119]:

Don't call debug_backtrace() with an argument for PHP 5.2.4, which is currently the lowest version we support. props swekitsune, kurtpayne. fixes #20953 for 3.4.

Note: See TracTickets for help on using tickets.