[wp-trac] [WordPress Trac] #7320: wp_update() makes category names
empty (v 2.6)
WordPress Trac
wp-trac at lists.automattic.com
Wed Jul 16 10:01:52 GMT 2008
#7320: wp_update() makes category names empty (v 2.6)
---------------------+------------------------------------------------------
Reporter: rm53 | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.6.1
Component: General | Version: 2.6
Severity: major | Keywords:
---------------------+------------------------------------------------------
Problem:
After upgrading an old version (e.g. 2.0) to 2.6 all category names are
empty, all slugs are -2 or -2-2 or longer sequences of "-2".
Bug:
I think I found the bug in function upgrade_230()
(upgrade_230 is in /wp-admin/includes/upgrade.php)
after these lines:
{{{
foreach ($categories as $category) {
$term_id = (int) $category->cat_ID;
$term_group = 0;
}}}
the variables $name, $slug and maybe others are NOT set,
but some lines later their content is used and written into mysql table as
follows:
{{{
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms
(term_id, name, slug, term_group) VALUES
(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
}}}
the result is IMHO: these fields are empty in the database, see the
numerous messages in the support forums about empty category names.
In the same function later on, for link cats the same code is repeated,
but with the vars $name etc set correctly:
{{{
foreach ( $link_cats as $category) {
$cat_id = (int) $category->cat_id;
$term_id = 0;
$name = $wpdb->escape($category->cat_name);
$slug = sanitize_title($name);
$term_group = 0;
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/7320>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list