• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

codeigniter4 / CodeIgniter4 / 25594735108

09 May 2026 06:57AM UTC coverage: 88.188% (-0.02%) from 88.205%
25594735108

Pull #10169

github

web-flow
Merge 87e792442 into 661af8ce4
Pull Request #10169: test: make random component execution safer

10 of 13 new or added lines in 5 files covered. (76.92%)

2 existing lines in 1 file now uncovered.

22114 of 25076 relevant lines covered (88.19%)

209.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/system/Cache/FactoriesCache/FileVarExportHandler.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter 4 framework.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Cache\FactoriesCache;
15

16
final class FileVarExportHandler
17
{
18
    private string $path = WRITEPATH . 'cache';
19

20
    public function save(string $key, mixed $val): void
21
    {
22
        $val = var_export($val, true);
32✔
23

24
        if (! is_dir($this->path) && ! @mkdir($this->path, 0777, true) && ! is_dir($this->path)) {
32✔
NEW
25
            return;
×
26
        }
27

28
        // Write to temp file first to ensure atomicity
29
        $tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp';
32✔
30
        if (file_put_contents($tmp, '<?php return ' . $val . ';', LOCK_EX) === false) {
32✔
NEW
31
            return;
×
32
        }
33

34
        if (! @rename($tmp, $this->path . "/{$key}")) {
32✔
NEW
35
            @unlink($tmp);
×
36
        }
37
    }
38

39
    public function delete(string $key): void
40
    {
41
        @unlink($this->path . "/{$key}");
2✔
42
    }
43

44
    public function get(string $key): mixed
45
    {
46
        return @include $this->path . "/{$key}";
35✔
47
    }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc