[wp-trac] Re: [WordPress Trac] #2268: get_option() on non-existent option always invokes new query

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 30 16:30:00 GMT 2007


#2268: get_option() on non-existent option always invokes new query
-------------------------------------+--------------------------------------
 Reporter:  markjaquith              |        Owner:  markjaquith
     Type:  defect                   |       Status:  reopened   
 Priority:  high                     |    Milestone:  2.2        
Component:  Optimization             |      Version:  2.1        
 Severity:  normal                   |   Resolution:             
 Keywords:  has-patch needs-testing  |  
-------------------------------------+--------------------------------------
Changes (by markjaquith):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 Maybe Donncha synced wpcom to a revision inbetween [4798] and [4831]

 That might do it.

 I have another fix for this issue that might be more foolproof.  It's
 certainly easier to code:

 Simply use a special string to designate that an option does not exist.
 e.g. {{{WP_OPTION_DOES_NOT_EXIST}}}.  You cache that in the options cache.
 That could be done purely in {{{get_option()}}}.  {{{update_option()}}}
 and {{{add_option()}}} could stay the same, because they'd just overwrite
 the {{{WP_OPTION_DOES_NOT_EXIST}}} string when they run
 {{{wp_cache_set()}}} on that option.

 It's not elegant, but it's the KISS solution.

 I'll make a patch [4798] + [4831] and test locally to see if saving the
 rewrite rules causes any funkiness and let you know what I find.

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


More information about the wp-trac mailing list