Changes between Initial Version and Version 34 of Ticket #22192
- Timestamp:
- 09/15/2023 07:46:06 AM (15 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #22192
-
Property
Status
changed from
new
toassigned
- Property Focuses performance added
- Property Cc knut@… atimmermans@… added
-
Property
Component
changed from
Performance
toOptions and Meta
-
Property
Summary
changed from
update_metadata() and update_option() strict checks can cause false negatives
toupdate_option() strict checks can cause false negatives
- Property Owner set to mukesh27
-
Property
Milestone
changed from
to
6.4
- Property Keywords has-patch 2nd-opinion dev-feedback has-unit-tests added; needs-patch needs-unit-tests removed
-
Property
Status
changed from
-
Ticket #22192 – Description
initial v34 2 2 3 3 {{{ 4 add_ post_meta( $post_id, 'key', 1 );5 update_ post_meta( $post_id, 'key', 1 );4 add_option( $option_name, 1 ); 5 update_option( $option_name, 1 ); 6 6 }}} 7 7 8 8 The update should not work, because they are the same. However, the meta cache will have "1" as a string, and then it will strict compare it to 1 as an integer. Thus, an unnecessary update will run. 9 9 10 Best I can tell, this could also affect update_option().11 12 10 It is quite common to use integers and booleans directly into these functions. They should be smart enough to recognize that "1" == 1 == true and "0" == 0 == false, and that any numeric string is also equal to a properly cast integer. 13 11 14 Unit tests needed.12 The new changes need unit tests. 15 13 16 14 Ticket from which this was spun: #22189, saving navigation menus is slow.