PHP_FUNCTION(strpos)
{
...
/* Swap needle and haystack if they appear to be backwards */
if (needle_len > haystack_len) {
char *t; int t_len;
t = needle; needle = haystack; haystack = t;
t_len = needle_len; needle_len = haystack_len; haystack_len =
t_len;
}
...
}
That's not valid since it may be the case that both the needle and the
haystack were generated from user input over which you have no idea
about the values and can make no assumptions. it would be a complete
mess to get false positives because the reversal just happened to match.
Sure... which is what my opening line was partially about:
At the risk of someone taking this as a worthwhile idea:
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php