[wp-trac] Re: [WordPress Trac] #8146: Quick tag/category edit appears to be using filtered data

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 13 02:10:21 GMT 2008


#8146: Quick tag/category edit appears to be using filtered data
-----------------------------------------+----------------------------------
 Reporter:  jhodgdon                     |        Owner:  anonymous
     Type:  defect                       |       Status:  reopened 
 Priority:  normal                       |    Milestone:  2.7      
Component:  Administration               |      Version:  2.7      
 Severity:  normal                       |   Resolution:           
 Keywords:  tag, category, edit, filter  |  
-----------------------------------------+----------------------------------
Comment (by jhodgdon):

 Well, I have at least identified the problem.

 We're in function _cat_row in wp-admin/template.php .

 The argument $category to this function is an object, which **has already
 been filtered for display** elsewhere, and is passed in to _cat_row.

 The first thing that _cat_row does is to call get_category( $category )
 [in wp-includes/category.php], which prompty calls get_term( $category )
 [in wp-includes/taxonomy.php].

 So about 10 lines down in get_term(), it says "Oh, I just received an
 object as input. I'll cache that." Note that it is caching a display-
 filtered object, not a raw-database-data object.

 After the return from get_category/get_term, farther down in the
 _get_row() function, it calls get_category_to_edit( $id ), which calls
 get_category( $id ), which calls get_term( $id ), which finds the cached
 data it previously cached (same ID), and uses that instead of doing a
 database query to get the real data. So it just returns display-filtered
 data instead of raw database data, even though the filter type is set to
 'raw' or 'edit'.

 The issue is that get_term is assuming that the object it is receiving as
 input and caching is equivalent to raw database output. But in this case,
 someone has passed in an object that has been filtered, and it should NOT
 be cached as raw database output.

 I think the solution might be just to remove that line from get_term that
 automatically caches any object passed in. But it might break something
 else? I do not know why it is there, but it seems wrong...

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8146#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list