﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
22192,update_metadata() and update_option() strict checks can cause false negatives,nacin,,"Given this:

{{{
add_post_meta( $post_id, 'key', 1 );
update_post_meta( $post_id, 'key', 1 );
}}}

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.

Best I can tell, this could also affect update_option().

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.

Unit tests needed.

Ticket from which this was spun: #22189, saving navigation menus is slow.",defect (bug),new,normal,Future Release,Performance,,normal,,needs-patch needs-unit-tests,knut@…
