[wp-trac] [WordPress Trac] #30339: Infinite loop while checking for post slug uniqueness
WordPress Trac
noreply at wordpress.org
Fri Nov 14 05:36:48 UTC 2014
#30339: Infinite loop while checking for post slug uniqueness
-------------------------------+-----------------------------
Reporter: julien731 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
When inserting a new hierarchical post of any type using
`wp_insert_post()`, the `wp_unique_post_slug()` function creates an
infinite loop when checking for already existing posts with the same slug.
In `wp_unique_post_slug()`, when entering the case of
`is_post_type_hierarchical()` (line 3698 in the trunk as of today), the
query is missing the `$post_type` variable when being prepared. The query
set in `$check_sql` contains 4 parameters but only 3 are given in
`$wpdb->prepare()` (line 3723) while looping in the post slugs.
As a result, `$wpdb->prepare()` returns `false` because of the last
argument (`post_parent`) not being given, and no SQL query is run at all.
`$wpdb->get_var()` then returns the last cached result.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30339>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list