[GH-ISSUE #796] Filename "0" #301

Closed
opened 2026-03-04 02:13:57 +03:00 by kerem · 1 comment
Owner

Originally created by @noplanman on GitHub (May 26, 2016).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/796

When trying to log to a file called 0 I get the following:
Fatal error: Uncaught exception 'LogicException' with message 'Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'

This happens because the string "0" is regarded as false here:
https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/StreamHandler.php#L84

Originally created by @noplanman on GitHub (May 26, 2016). Original GitHub issue: https://github.com/Seldaek/monolog/issues/796 When trying to log to a file called `0` I get the following: `Fatal error: Uncaught exception 'LogicException' with message 'Missing stream url, the stream can not be opened. This may be caused by a premature call to close().'` This happens because the string `"0"` is regarded as `false` here: https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/StreamHandler.php#L84
kerem closed this issue 2026-03-04 02:13:57 +03:00
Author
Owner

@Seldaek commented on GitHub (May 26, 2016):

Curious why you'd call a log file '0' but anyway I'll push a fix as it's quite an easy one.

<!-- gh-comment-id:221969689 --> @Seldaek commented on GitHub (May 26, 2016): Curious why you'd call a log file '0' but anyway I'll push a fix as it's quite an easy one.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#301
No description provided.