[php-src] Issue #8306: sapi/phpdbg/phpdbg.c:861: 2 * wrong operator ?
| From: | dcb314 | Date: | Tue, 05 Apr 2022 18:44:47 +0000 |
| Subject: | [php-src] Issue #8306: sapi/phpdbg/phpdbg.c:861: 2 * wrong operator ? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240678@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8306
Author: dcb314
### Description
I just compiled php-8.1.4 with the new compiler clang-14. It said:
php-8.1.4/sapi/phpdbg/phpdbg.c:861:7: warning: use of bitwise '|' with boolean operands
[-Wbitwise-instead-of-logical]
php-8.1.4/sapi/phpdbg/phpdbg.c:861:8: warning: use of bitwise '&' with boolean
operands
[-Wbitwise-instead-of-logical]
Source code is
if (((fstat(fileno(stderr), &stat[2]) < 0) & (fstat(fileno(stdout),
&stat[0]) < 0)) | (fstat(data->fd, &stat[1]) < 0)) {
Maybe better code:
if (((fstat(fileno(stderr), &stat[2]) < 0) && (fstat(fileno(stdout),
&stat[0]) < 0)) || (fstat(data->fd, &stat[1]) < 0)) {
### PHP Version
pgp 8.1.4
### Operating System
Linux fedora 36 beta