xref: /PHP-8.0/ext/standard/tests/file/bug74719.phpt (revision a555cc0b)
1--TEST--
2Bug #74719 Allow NULL as context, testing fopen, rename, unlink, mkdir and rmdir
3--CREDITS--
4Alexander Holman <alexander@holman.org.uk>
5--FILE--
6<?php
7
8// fopen
9$tmpFile = __DIR__ . "/bug74719.tmp";
10$h = fopen($tmpFile, "w", false, NULL);
11if ($h !== false) {
12    echo "ok\n";
13    fclose($h);
14}
15
16$newTmpFile = __DIR__ . "/bug74719_renamed.tmp";
17if (rename($tmpFile, $newTmpFile, NULL)) {
18    echo "ok\n";
19}
20
21if (unlink($newTmpFile, NULL)) {
22    echo "ok\n";
23}
24
25$tmpDir = __DIR__ . "/bug74719_dir";
26
27if (mkdir($tmpDir, 0777, false, NULL)) {
28    echo "ok\n";
29}
30
31if (rmdir($tmpDir, NULL)) {
32    echo "ok\n";
33}
34
35?>
36--EXPECT--
37ok
38ok
39ok
40ok
41ok
42