Notice: Trying to access array offset on value of type bool in worker.php 2129 这个错误是什么错误啊,在window下

workmanxinshou

Notice: Trying to access array offset on value of type bool in worker.php 2129 这个错误是什么错误啊,在window下

如何去掉改错误!

9133 2 0
2个回答

workmanxinshou
private static function outputStream($stream = null)
{
    if (!$stream) {
        $stream = static::$_outputStream ? static::$_outputStream : \STDOUT;
    }
    if (!$stream || !\is_resource($stream) || 'stream' !== \get_resource_type($stream)) {
        return false;
    }
    $stat = \fstat($stream);
    if (($stat['mode'] & 0170000) === 0100000) {
        // file
        static::$_outputDecorated = false;
    } else {
        static::$_outputDecorated =
            static::$_OS === \OS_TYPE_LINUX &&
            \function_exists('posix_isatty') &&
            \posix_isatty($stream);
    }
    return static::$_outputStream = $stream;
}

这函数中的 if (($stat['mode'] & 0170000) === 0100000) { 这句话报的错误。

  • 暂无评论
blogdaren

1、这段代码看上去确实有触发题示BUG的可能;
2、贴下workerman版本、以及重现问题的 demo 代码;

  • workmanxinshou 2019-12-06

    就是最新的work版本。

  • blogdaren 2019-12-06

    1、受上下文诸多因素影响,别人无法根据提供的仅有数据重现这个报错,所以要解决问题:请贴出重现代码,贴出 php start.php status 截图以及其他尽可能多的运行环境。
    2、另外据我所知:PHP 7.4.0 beta2 版本的fstat 有bug, 见官方:
    https://bugs.php.net/bug.php?id=78386

  • ccslovesdy 2019-12-13

    @614:我也遇到了,PHP7.4.0,Gateway源码,未修改,win10 X64 运行一段时间后出现这种情况

  • AccessDenied 2020-06-19

    我也遇到了,PHP7.4.0,Gateway源码,未修改,win10 X64 运行一段时间后出现这种情况

年代过于久远,无法发表回答
🔝