Make WordPress Core

Opened 18 years ago

Closed 17 years ago

#8808 closed defect (bug) (fixed)

If publish_future_post is called before its time, It creates a duplicate entry

Reported by: DD32 Owned by: ryan
Priority: normal Milestone: 2.8
Component: General Version: 2.8
Severity: trivial Keywords: needs-testing
Cc: Focuses:

Description

when the publish_future_post hook is called, ahead of its time, it'll attempt to cancel the current scheduled event, and schedule another, However, at present, this fails to work 100%

The issue is, That the $args need to match exactly, the event is originally scheduled with array( (string)$ID ), however, the clear/reschedule gets called with array( (int)$ID) which causes the cron ID key to differ slightly, which results in the first schedule not being canceled, and a duplicate schedule being created (with an int as the ID instead of the ID as a string)

(In addition to that, It seems the clear schedule call isnt passed a array too, which results in the key being different again..)

The $ID gets set to a int, thanks to get_post() accepting the ID by reference, and then typecasting it to an int.

The attached patch typecasts it to a string as well as wrapping it in the missing array()

In normal working environments, this shouldn't occur at all, and if it does, the schedule will be duplicated only once due to the 2nd and future sharing the same key.

Attachments (1)

8808.diff (1.1 KB ) - added by DD32 18 years ago.

Download all attachments as: .zip

Change History (9)

@DD32
18 years ago

#1 @DD32
18 years ago

  • Keywords has-patch added

#2 @DD32
17 years ago

any traction..?

#3 @ryan
17 years ago

  • Owner changed from anonymous to ryan

#4 @Denis-de-Bernardy
17 years ago

apparently not much. :-)

#5 @Denis-de-Bernardy
17 years ago

Patch applies cleanly against today's trunk.

#7 @westi
17 years ago

  • Keywords needs-testing added; has-patch removed

[11282] may have fixed this.

#8 @ryan
17 years ago

  • Resolutionfixed
  • Status newclosed

I think it does.

Note: See TracTickets for help on using tickets.