1--TEST--
2Check permissions for created errorlog file
3--SKIPIF--
4<?php
5if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
6    die("skip this test on windows");
7}
8?>
9--INI--
10error_log=error_permissions_test.log
11error_log_mode=0600
12--FILE--
13<?php
14
15const LOG_FILENAME='error_permissions_test.log';
16
17try {
18    if (file_exists(LOG_FILENAME)) {
19        unlink(LOG_FILENAME);
20    }
21    $oldMask = umask(0000);
22
23    error_log("hello world");
24
25    assert(file_exists(LOG_FILENAME));
26
27    printf("got permissions=%o\n", fileperms(LOG_FILENAME) & 0777);
28    printf("errorlog contents\n%s", file_get_contents(LOG_FILENAME));
29
30    umask($oldMask);
31} finally {
32    unlink(LOG_FILENAME);
33}
34?>
35--EXPECTF--
36got permissions=600
37errorlog contents
38[%d-%s-%d %d:%d:%d %s] hello world
39