Doc #68542 [NEW]: Relational operators semantics is different with actual behavior.
| From: | y dot uchiyama dot 1015 at gmail dot com | Date: | Wed, 03 Dec 2014 14:02:41 +0000 |
| Subject: | Doc #68542 [NEW]: Relational operators semantics is different with actual behavior. | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-11720@lists.php.net to get a copy of this message | ||
From: y dot uchiyama dot 1015 at gmail dot com
Operating system:
PHP version: Irrelevant
Package: PHP Language Specification
Bug Type: Documentation Problem
Bug description:Relational operators semantics is different with actual behavior.
Description:
------------
The semantics of relational operators (in 10-expressions.md) is
different with the actual behavior of PHP, in case that both operands
are string (the semantics says rules 2 and 4 are applied).
In this case, numeric comparison is applied only if both operands are
numeric string without overflow, otherwise lexical comparison is
applied.
Some examples are shown below.
echo ('1' == '0x1') . "\n"; // true
echo ('1' == '1a') . "\n"; // false
echo ('1234567890' == '1234567890.0') . "\n"; // true
echo ('123456789012345678901234567890' ==
'123456789012345678901234567890.0') . "\n"; // false
echo ('1e10' == '1.0e10') . "\n"; // true
echo ('1e1000' == '1.0e1000') . "\n"; // false
--
Edit bug report at https://bugs.php.net/bug.php?id=68542&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68542&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68542&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68542&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68542&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68542&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68542&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68542&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68542&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68542&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68542&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68542&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68542&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68542&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68542&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68542&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68542&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68542&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68542&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68542&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68542&r=mysqlcfg