{"record":{"id":"d5c01e4bc2e60a14","repo":"flarum/framework","slug":"errno-errstr-errfile-errline","errorCode":null,"errorMessage":"$errno, $errstr, $errfile:$errline","messagePattern":"\\$errno, \\$errstr, \\$errfile:\\$errline","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"extensions/realtime/src/Websocket/Console/ServeCommand.php","lineNumber":130,"sourceCode":"                ->enable($debug)\n                ->verbose($this->output->isVerbose());\n        });\n    }\n\n    public function errorHandler(int $errno, string $errstr, string $errfile, int $errline): bool\n    {\n        // Don't throw exceptions for deprecation notices, warnings, or notices in debug mode\n        // Just log them to output instead\n        if (in_array($errno, [E_DEPRECATED, E_USER_DEPRECATED, E_NOTICE, E_USER_NOTICE])) {\n            if ($this->option('debug')) {\n                $this->warn(\"[$errno] $errstr in $errfile:$errline\");\n            }\n\n            return true;\n        }\n\n        // Throw exceptions for actual errors\n        throw new \\Exception(\"$errno, $errstr, $errfile:$errline\");\n    }\n\n    /**\n     * Expire stale index-typing presence and emit falling-edge \"stopped typing\"\n     * signals, so list dots clear without each client running its own per-discussion\n     * timer. Swept faster than the TTL (6s) to keep the clear-lag small.\n     */\n    protected function sweepIndexTyping(LoopInterface $loop): void\n    {\n        $presence = $this->getLaravel()->make(IndexTypingPresence::class);\n\n        $loop->addPeriodicTimer(2, function () use ($presence) {\n            $presence->sweep();\n        });\n    }\n\n    /**\n     * The daemon restarts on every deployment, so a fresh start signals that the","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/extensions/realtime/src/Websocket/Console/ServeCommand.php#L112-L148","documentation":"ServeCommand installs a PHP error handler while running the realtime websocket server; non-fatal notices/warnings are suppressed (returns true), but any real PHP error is converted into a generic Exception whose message is just \"$errno, $errstr, $errfile:$errline\". This forces the server to stop on actual errors instead of continuing in a broken state.","triggerScenarios":"Any PHP error-level condition (E_ERROR-class, unhandled warning escalated, undefined function/class, failed include, type errors) raised during the websocket server's request loop while the custom error handler is active, e.g. a buggy extension listener invoked from a Message component.","commonSituations":"A listener or middleware referencing an undefined method/class on the server; missing PHP extension causing a fatal at runtime; file include failing in a long-running worker; extension code raising warnings that the configured error level escalates to exceptions.","solutions":["Read the embedded $errstr, $errfile and $errline in the message — they point at the actual underlying error; fix that code first.","Reproduce with the same code path outside the websocket server (normal HTTP request or unit test) to get a full stack trace.","Check that all extensions enabled on the forum are compatible and load cleanly under the CLI/serve context.","Verify required PHP extensions (sockets, mbstring, etc.) are installed for the user running the serve command."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $server->run();\n} catch (\\Exception $e) {\n    // message embeds \"errno, errstr, errfile:errline\" — parse or log as-is for diagnosis\n    logger()->error('Websocket serve crashed: ' . $e->getMessage());\n}","preventionTips":["Fix the underlying file:line named in the message — this error is always a wrapper.","Keep extensions enabled on the websocket server load-clean (no undefined classes/methods).","Run the forum in a normal request first to surface the original error with a stack trace.","Ensure required PHP extensions (sockets, pcntl) are installed in the serve environment."],"tags":["websocket","php-error-handler","runtime","server"],"backgroundTag":"internal-invariant-violation","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}