Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#35892 closed defect (bug) (invalid)

Small issue in "get_calendar" function

Reported by: yetanotherdaniel's profile yetAnotherDaniel Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Widgets Keywords:
Focuses: Cc:


In the "get_calendar" function (wp-includes/general-template.php) the following wpdb method with a SQL command is called:

'get_var("SELECT 1'

This will not work as "get_var" does not support that:

The error is tiny. However, this seems to be a common mistake if you google for:
"get_var" "SELECT 1"

I either suggest to enable this functionality in the "get_var" method or fix it in get_calendar function as well as describe the issue in the codex (

Change History (3)

This ticket was mentioned in Slack in #core by dd32. View the logs.

8 years ago

#2 @pento
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.4.2 deleted

Thanks for the bug report!

The query in get_calendar() is written as SELECT 1 as test..., which does work correctly with mysqli_fetch_object().

It would require significant re-engineering and edge case handling in WPDB to handle the SELECT 1... case, which doesn't seem to have much payoff when there are simple workarounds available.

#3 @yetAnotherDaniel
8 years ago

You are right, I did saw the 'as test' as this is not a usual SQL syntax.

A hint in the codex would be perfect as this is a common error.

Thank you!

Note: See TracTickets for help on using tickets.