rfc:inconsistent-behaviors
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:inconsistent-behaviors [2014/02/05 21:44] – Added notes about PHP numeroalphabetic behavior as unexceptional sanfordwhiteman | rfc:inconsistent-behaviors [2017/09/22 13:28] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 25: | Line 25: | ||
Type juggling only works for INTEGER or HEX like strings. | Type juggling only works for INTEGER or HEX like strings. | ||
+ | |||
+ | Most problematic is HEX like strings being auto-coerced during | ||
+ | comparison, but using //different rules// from manual casting. That | ||
+ | is, ( 0x0A == " | ||
+ | although " | ||
+ | |||
+ | This despite http:// | ||
+ | states clearly that for number-string comparison, we " | ||
+ | strings and resources to numbers." | ||
+ | string patterns cannot be " | ||
+ | a " | ||
+ | casting for the same string. It is hard to view it is anything but a | ||
+ | bug that it does not. | ||
=== HEX === | === HEX === | ||
Line 159: | Line 172: | ||
Not only is this not a bug, it isn't even exceptional behavior on the | Not only is this not a bug, it isn't even exceptional behavior on the | ||
- | modern web. A user who find this behavior surprising | + | modern web. Users who find this behavior surprising |
inexperienced with MySQL -- clearly PHP's partner in server-side | inexperienced with MySQL -- clearly PHP's partner in server-side | ||
ubiquity as part of the dominant *AMP stack -- which has the exact | ubiquity as part of the dominant *AMP stack -- which has the exact | ||
same rules for auto-coercion of " | same rules for auto-coercion of " | ||
- | comparison context. | + | comparison context. |
In MySQL (all supported versions): | In MySQL (all supported versions): | ||
Line 285: | Line 298: | ||
https:// | https:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== filter_var ==== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | <code php> | ||
+ | var_dump(filter_var(' | ||
+ | var_dump(filter_var(' | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | bool(false) | ||
+ | double(1) | ||
+ | </ | ||
Line 303: | Line 332: | ||
http:// | http:// | ||
+ | |||
+ | |||
rfc/inconsistent-behaviors.txt · Last modified: 2021/03/27 14:31 by ilutov