error_log() doesn't respect error_log_mode INI setting
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Logs created by PHP's error_log INI setting have the correct mode but the error_log() function appears to ignore the error_log_mode setting. I've tried setting error_log_mode using ini_set() and as a PHP-FPM php_admin_value.
The following code:
<?php
ini_set('error_log_mode', '0o200');
error_log('Something went wrong', 3, 'exceptions.log');
Resulted in this output:
-rw-r--r--. 1 apache apache 20 Nov 24 23:07 exceptions.log
But I expected this output instead:
--w-------. 1 apache apache 20 Nov 24 23:07 exceptions.log
PHP Version
PHP 8.2.13
Operating System
Rocky Linux 9.2 (Blue Onyx)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the PHP 8.2.13 example with error_log_mode set through ini_set() and error_log() writing to exceptions.log. Trace the error_log handling in php-src and verify that the configured mode affects files created with message type 3, including a regression test for the reported permissions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100