Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#26218 closed defect (bug) (fixed)

add_query_arg() being called incorrectly in ~/wp-includes/cron.php (Version 3.8-beta-1)

Reported by: datafeedrcom's profile datafeedr.com Owned by: ocean90's profile ocean90
Milestone: 3.8 Priority: normal
Severity: major Version: 3.8
Component: Cron API Keywords: has-patch commit
Focuses: Cc:

Description

On line 275 in ~/wp-includes/cron.php an array() is being passed to the add_query_arg() function:

		'url'  => add_query_arg( array( 'doing_wp_cron', $doing_wp_cron ), site_url( 'wp-cron.php' ) ),

This is producing a URL where the array indexes 0 and 1 are being used as keys. The URL looks like this:

site.com/wp-cron.php?0=doing_wp_cron&1=1385316015.1194360256195068359375

However the URL should be formatted like this:

site.com/wp-cron.php?doing_wp_cron=1385316015.1194360256195068359375

Therefore the above line should be changed to:

		'url'  => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ),

This will format the URL being passed to wp-cron.php properly and allow the cron to run.

Eric

Attachments (1)

26218.patch (535 bytes) - added by dimadin 10 years ago.

Download all attachments as: .zip

Change History (8)

@dimadin
10 years ago

#1 @dimadin
10 years ago

  • Keywords has-patch added; needs-patch removed

For the record, this started with [26267], see ticket:25475#comment:6

#2 @ocean90
10 years ago

  • Keywords commit added; 2nd-opinion dev-feedback removed
  • Milestone changed from Awaiting Review to 3.8

Thanks for the report. It should be array( 'doing_wp_cron' => $doing_wp_cron ), but I'm fine with 26218.patch.

#3 follow-up: @dimadin
10 years ago

Out of curiosity, why it should be array? In the same file we have add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_SERVER['REQUEST_URI'] ) ) and I did a quick search in core and it looks we are using this form when there is only one key.

#4 @ocean90
10 years ago

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

In 26365:

Cron Request: Fix incorrect use of add_query_arg() arguments.

props datafeedrcom, dimadin.
see [26267].
fixes #26218.

#5 in reply to: ↑ 3 @ocean90
10 years ago

Replying to dimadin:

Out of curiosity, why it should be array?

I meant originally. Of course there is no need for an array if there is only one key.

#6 @datafeedr.com
10 years ago

@dimadin - thanks for the quick patch!

@ocean90 - thanks for the quick commit!

#7 @SergeyBiryukov
10 years ago

#26301 was marked as a duplicate.

Note: See TracTickets for help on using tickets.