Skip to content

sapi/phpdbg/phpdbg.c:861: 2 * wrong operator ? #8306

Closed
@dcb314

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions