WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#47638 closed defect (bug) (fixed)

Undefined variable: climits in class-wp-query.php at line 2632.

Reported by: agengineering Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: minor Version: 5.2.2
Component: Query Keywords: has-screenshots good-first-bug has-patch
Focuses: Cc:
PR Number:

Description

Hi there,

sometimes I find this bug in debug_log file: Undefined variable: climits in /www/wptest/public/wp-includes/class-wp-query.php at line 2632.
I have opened the file class-wp-query.php and I think the issue is that $climits variable isn't initialized.

Look this screenshot for more details:http://prntscr.com/o9j9z6

Attachments (1)

47638.diff (556 bytes) - added by juiiee8487 5 months ago.
Created patch.

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
5 months ago

  • Keywords good-first-bug added; dev-feedback removed
  • Milestone changed from Awaiting Review to 5.3

Hi @agengineering, welcome to WordPress Trac! Thanks for the report.

Indeed, $climits is only defined inside a conditional. Good catch!

@juiiee8487
5 months ago

Created patch.

#2 @juiiee8487
5 months ago

  • Keywords has-patch added; needs-patch removed

I have created patch 47638.diff which defines a $climits variable outside of the condition.

#3 @SergeyBiryukov
5 months ago

  • Component changed from General to Query

#4 @SergeyBiryukov
5 months ago

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

In 45591:

Query: Make sure $climits variable in WP_Query::get_posts() is always defined to avoid a PHP notice.

Props juiiee8487, agengineering.
Fixes #47638.

#5 @agengineering
5 months ago

Hi @SergeyBiryukov and @juiiee8487

Thanks for your time!
I'm happy to reporting this issue.

Note: See TracTickets for help on using tickets.