Notice: Trying to access array offset on value of type bool in worker.php 2129 這個(gè)錯(cuò)誤是什么錯(cuò)誤啊,在window下
如何去掉改錯(cuò)誤!
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;
}
這函數(shù)中的 if (($stat['mode'] & 0170000) === 0100000) { 這句話報(bào)的錯(cuò)誤。
1、這段代碼看上去確實(shí)有觸發(fā)題示BUG的可能;
2、貼下workerman版本、以及重現(xiàn)問(wèn)題的 demo 代碼;
1、受上下文諸多因素影響,別人無(wú)法根據(jù)提供的僅有數(shù)據(jù)重現(xiàn)這個(gè)報(bào)錯(cuò),所以要解決問(wèn)題:請(qǐng)貼出重現(xiàn)代碼,貼出 php start.php status 截圖以及其他盡可能多的運(yùn)行環(huán)境。
2、另外據(jù)我所知:PHP 7.4.0 beta2 版本的fstat 有bug, 見官方:
https://bugs.php.net/bug.php?id=78386