get_metastring_id() fails if a metastring 0 is cached
|Reported by:||cash||Owned by:|
This is probably my most favorite bug that I've come across.
array_search($string, $METASTRINGS_CACHE); will return the index to an element in $METASTRINGS_CACHE that is zero (the number) for any $string. This causes some really interesting behavior that is difficult to debug. This happens, of course, because "string" == 0 returns true but you generally are not thinking about that when you use array_search(). The solution is to set strict to true so that the comparison is done with ===.