[wp-trac] Re: [WordPress Trac] #4596: use_desc_for_title doesnt work in wp_list_categories()

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 28 04:22:09 GMT 2007


#4596: use_desc_for_title doesnt work in wp_list_categories()
-------------------------------------------------------------------+--------
 Reporter:  tiosolid                                               |        Owner:  anonymous
     Type:  defect                                                 |       Status:  new      
 Priority:  normal                                                 |    Milestone:  2.4      
Component:  General                                                |      Version:  2.2.1    
 Severity:  normal                                                 |   Resolution:           
 Keywords:  wp_list_categories categories lists reporter-feedback  |  
-------------------------------------------------------------------+--------
Changes (by darkdragon):

  * keywords:  wp_list_categories, categories, lists => wp_list_categories
               categories lists reporter-feedback

Comment:

 Question: Was the operator between those two an {{{||}}} or an {{{&&}}}
 when you were having trouble?

 This is an interesting bug. However, it appears that Trac removed some
 formatting from the description. I'm going to try to track down and see
 what the rest of the string is.

 It appears that the line is using the correct logic, however, because of
 PHP implicit type jungling it is unclear whether your {{{TRUE}}} value is
 being type casted to {{{INT 1}}}.

 It might be better to explicitly type cast {{{$use_desc_for_title}}} to
 boolean and then test for {{{false}}} value. However, type casting
 anything to boolean means that an empty variable and 0 will have
 {{{false}}} value and everything else will have {{{true}}} value.

 With:

 {{{ if( (bool) $use_desc_for_title === false || empty(
 $category->description ) ) }}}

 These '''should have''' false values:

  * {{{ $use_desc_for_title = '' }}}
  * {{{ $use_desc_for_title = 0 }}}
  * {{{ $use_desc_for_title = false }}}

 These '''should have''' true values:

  * {{{ $use_desc_for_title = true }}}
  * {{{ $use_desc_for_title = 'a' }}}
  * {{{ $use_desc_for_title = 1 }}}

 It is unlikely that a drastic logic modification like removing the
 variable check would help anything. The logic itself should be fixed.

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


More information about the wp-trac mailing list