Bug #68146 [Opn->Nab]: Condition Grouping Review (zend_virtual_cwd.h)
| From: | requinix@php.net | Date: | Fri, 03 Oct 2014 19:51:06 +0000 |
| Subject: | Bug #68146 [Opn->Nab]: Condition Grouping Review (zend_virtual_cwd.h) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187826@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68146&edit=1
ID: 68146
Updated by: requinix@php.net
Reported by: pegasus at vaultwiki dot org
Summary: Condition Grouping Review (zend_virtual_cwd.h)
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: master-Git-2014-10-03 (Git)
Block user comment: N
Private report: N
New Comment:
&& has higher precedence than || so the parentheses aren't needed.
Previous Comments:
------------------------------------------------------------------------
[2014-10-03 19:06:34] pegasus at vaultwiki dot org
Description:
------------
I was just reading through recent commits and saw this for zend/zend_virtual_cwd.h (commit#
647ebe6bf214d1a30627bab1758b66262d2f780f)
- (len >= 2 && ((/* is local */isalpha(path[0]) && path[1] ==
':') || /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))
+ (len >= 2 && (/* is local */isalpha(path[0]) && path[1] == ':'
|| /* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1])))
I could be forgetting my order of operations, but I think the lack of grouping and similar
operations causes LTR here... Shouldn't the proper parenthetical grouping be:
(len >= 2 && ((/* is local */isalpha(path[0]) && path[1] == ':')
|| (/* is UNC */IS_SLASH(path[0]) && IS_SLASH(path[1]))))
Here it is tabulated for clarity:
(
len >= 2 &&
(
(
/* is local */
isalpha(path[0]) &&
path[1] == ':'
) ||
(
/* is UNC */
IS_SLASH(path[0]) &&
IS_SLASH(path[1])
)
)
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68146&edit=1