#22944 closed defect (bug) (fixed)
Scheduled posts trigger the non-unfiltered_html filters (regression)
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | 3.5.1 |
| Component: | General | Version: | 3.5 |
| Severity: | critical | Keywords: | has-patch commit |
| Cc: | esmi@…, info@…, japh@…, jartes |
Description
To reproduce:
- Create a post
- Put some iframe or embed or whatever code in it, like a youtube iframe:
<iframe width="420" height="315" src="http://www.youtube.com/embed/oHg5SJYRHA0?rel=0" frameborder="0" allowfullscreen></iframe>
- Schedule the post for the future. One minute in the future will do.
When the post publishes, the iframe will be gone.
Something about the future-post triggers the kses filters. Since the user making the post (wp-cron) is unauthenticated, the unfiltered_html cap is not applied, and the filters engage, cleaning the post before it publishes.
Problem found in 3.5. Have not checked 3.4.2 yet to see if this is a regression.
Attachments (4)
Change History (24)
- Priority changed from normal to high
- Severity changed from normal to major
- Summary changed from Scheduled posts trigger the non-unfiltered_html filters to Scheduled posts trigger the non-unfiltered_html filters (regression)
comment:2
markoheijnen — 5 months ago
Isn't this then for milestone 3.5.1?
comment:3
SergeyBiryukov — 5 months ago
- Milestone changed from Awaiting Review to 3.5.1
Moving for investigation.
Note that the act of publishing by the cron job also appears to create a revision with a post_author of zero. This also didn't happen in 3.4.2.
This is wp_publish_post(). We should restore it to a straight DB call.
It's a shame. wp_insert_post() is our lowest level API, but it just has too much crap in it. We need something lower.
- Cc esmi@… added
If WP 3.5.1 isn't going to be out for a few weeks, is there any chance of a fix being dropped into the Hotfix plugin? This hitting more than iframe markup. I'm seeing support post complaining that it's hitting script and even div tags (although that's one I haven't confirmed yet).
SergeyBiryukov — 5 months ago
comment:7
in reply to:
↑ 4
SergeyBiryukov — 5 months ago
- Keywords has-patch added
Related: [21942], ticket:11399:20, ticket:11399:22
- Keywords needs-unit-tests added
Unit tests should cover two situations:
- A future-dated post should be forcibly moved to publish with wp_publish_post().
- A post should not get its content touched by kses when wp_publish_post() is called.
- Keywords needs-docs added
The PHPDoc was changed in [21942] -- after the patch it no longer @uses wp_update_post()
SergeyBiryukov — 5 months ago
comment:11
SergeyBiryukov — 5 months ago
- Keywords needs-docs removed
SergeyBiryukov — 5 months ago
SergeyBiryukov — 5 months ago
comment:12
in reply to:
↑ 8
;
follow-up:
↓ 14
SergeyBiryukov — 5 months ago
22944.test.patch is an attempt at the unit test.
Replying to nacin:
A future-dated post should be forcibly moved to publish with wp_publish_post().
This currently doesn't happen due to the check in wp_insert_post():
http://core.trac.wordpress.org/browser/tags/3.5/wp-includes/post.php#L2817
22944.2.patch fixes that, however it turned out that clean_post_cache() is also needed for the test to pass. Added in 22944.3.patch. Not sure if the test should call it or wp_publish_post() itself.
comment:13
toscho — 5 months ago
- Cc info@… added
comment:14
in reply to:
↑ 12
nacin — 5 months ago
Replying to SergeyBiryukov:
22944.2.patch fixes that, however it turned out that clean_post_cache() is also needed for the test to pass. Added in 22944.3.patch. Not sure if the test should call it or wp_publish_post() itself.
wp_publish_post() needs to call clean_post_cache() on its own. It did it implicitly in 3.5 via the save_post hook, but that meant we were calling it twice on wp_insert_post(), and that made no sense.
comment:15
nacin — 5 months ago
In 1174/tests:
comment:16
nacin — 5 months ago
- Owner set to nacin
- Resolution set to fixed
- Status changed from new to closed
In 23206:
comment:17
nacin — 5 months ago
In 23207:
comment:18
nacin — 5 months ago
- Keywords needs-unit-tests removed
comment:19
Japh — 4 months ago
- Cc japh@… added
comment:20
jartes — 4 months ago
- Cc jartes added

Confirmed this as a regression, problem does not exist in 3.4.2.