[wp-trac] [WordPress Trac] #22192: update_option() strict checks can cause false negatives

WordPress Trac noreply at wordpress.org
Tue Oct 10 15:57:23 UTC 2023


#22192: update_option() strict checks can cause false negatives
--------------------------------------------+--------------------------
 Reporter:  nacin                           |       Owner:  mukesh27
     Type:  defect (bug)                    |      Status:  reopened
 Priority:  normal                          |   Milestone:  6.4
Component:  Options, Meta APIs              |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  has-patch has-unit-tests close  |     Focuses:  performance
--------------------------------------------+--------------------------
Changes (by flixos90):

 * keywords:  has-patch has-unit-tests => has-patch has-unit-tests close


Comment:

 Replying to [comment:83 snicco]:
 > We extensively use the pre_get_option filter to insert an encryption
 layer between the WordPress database, where options are stored, and
 between the runtime values passed to PHP.

 For such behaviors, where general changes to fetching any options are
 made, the `pre_option` filter should be used, which is intentionally not
 modified here. `pre_option_{$option}` is for specific options, so it has
 different implications.

 > Different calls to get_option() must not return different values.

 While I wish this was true, realistically it isn't the case, since with
 WordPress's filter system any call may return something different.

 @costdev I think for the above reason we shouldn't do what you proposed in
 https://github.com/WordPress/wordpress-develop/pull/5448.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/22192#comment:86>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list