{"record":{"id":"c1f5a39b14bafa31","repo":"Seldaek/monolog","slug":"failed-setting-chunk-size-with-stream-set-chunk-si","errorCode":null,"errorMessage":"Failed setting chunk size with stream_set_chunk_size()","messagePattern":"Failed setting chunk size with stream_set_chunk_size\\(\\)","errorType":"exception","errorClass":"UnexpectedValueException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/SocketHandler.php","lineNumber":379,"sourceCode":"            $resource = $this->fsockopen();\n        }\n        if (\\is_bool($resource)) {\n            throw new \\UnexpectedValueException(\"Failed connecting to $this->connectionString ($this->errno: $this->errstr)\");\n        }\n        $this->resource = $resource;\n    }\n\n    private function setSocketTimeout(): void\n    {\n        if (!$this->streamSetTimeout()) {\n            throw new \\UnexpectedValueException(\"Failed setting timeout with stream_set_timeout()\");\n        }\n    }\n\n    private function setStreamChunkSize(): void\n    {\n        if (null !== $this->chunkSize && false === $this->streamSetChunkSize()) {\n            throw new \\UnexpectedValueException(\"Failed setting chunk size with stream_set_chunk_size()\");\n        }\n    }\n\n    private function writeToSocket(string $data): void\n    {\n        $length = \\strlen($data);\n        $sent = 0;\n        $this->lastSentBytes = $sent;\n        while ($this->isConnected() && $sent < $length) {\n            if (0 === $sent) {\n                $chunk = $this->fwrite($data);\n            } else {\n                $chunk = $this->fwrite(substr($data, $sent));\n            }\n            if ($chunk === false) {\n                throw new \\RuntimeException(\"Could not write to socket\");\n            }\n            $sent += $chunk;","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/SocketHandler.php#L361-L397","documentation":"Error \"Failed setting chunk size with stream_set_chunk_size()\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/SocketHandler.php:379 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}