From bf6f02320a83dba4e9b9fb0908dc717163868002 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 6 Nov 2013 23:41:09 +0000 Subject: [PATCH] A negative term parent value should be sanitized to 0, not 1. Fix a regression in sanitize_term_field() caused by [26010]. props mattheu for initial patch. fixes #25852. Built from https://develop.svn.wordpress.org/trunk@26028 git-svn-id: http://core.svn.wordpress.org/trunk@25958 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 12c2a6b99c..06a9126616 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1710,8 +1710,11 @@ function sanitize_term($term, $taxonomy, $context = 'display') { */ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) { $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' ); - if ( in_array( $field, $int_fields ) ) - $value = absint( $value ); + if ( in_array( $field, $int_fields ) ) { + $value = (int) $value; + if ( $value < 0 ) + $value = 0; + } if ( 'raw' == $context ) return $value;