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

codeigniter4 / CodeIgniter4 / 25734057700

12 May 2026 12:21PM UTC coverage: 88.195%. First build
25734057700

Pull #10193

github

web-flow
Merge b8665b94e into f5ad0cb05
Pull Request #10193: fix: disable HotReloader zlib compression with falsey value

0 of 1 new or added line in 1 file covered. (0.0%)

22114 of 25074 relevant lines covered (88.19%)

210.0 hits per line

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

0.0
/system/HotReloader/HotReloader.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\HotReloader;
15

16
/**
17
 * @internal
18
 */
19
final class HotReloader
20
{
21
    public function run(): void
22
    {
23
        if (session_status() === PHP_SESSION_ACTIVE) {
×
24
            session_write_close();
×
25
        }
26

27
        // Use "0" because ini_get() returns "Off" as a truthy string at runtime.
NEW
28
        ini_set('zlib.output_compression', '0');
×
29

30
        header('Cache-Control: no-store');
×
31
        header('Content-Type: text/event-stream');
×
32
        header('Access-Control-Allow-Methods: GET');
×
33

34
        ob_end_clean();
×
35
        set_time_limit(0);
×
36

37
        $hasher  = new DirectoryHasher();
×
38
        $appHash = $hasher->hash();
×
39

40
        while (true) {
×
41
            if (connection_status() !== CONNECTION_NORMAL || connection_aborted() === 1) {
×
42
                break;
×
43
            }
44

45
            $currentHash = $hasher->hash();
×
46

47
            // If hash has changed, tell the browser to reload.
48
            if ($currentHash !== $appHash) {
×
49
                $appHash = $currentHash;
×
50

51
                $this->sendEvent('reload', ['time' => date('Y-m-d H:i:s')]);
×
52
                break;
×
53
            }
54

55
            if (mt_rand(1, 10) > 8) {
×
56
                $this->sendEvent('ping', ['time' => date('Y-m-d H:i:s')]);
×
57
            }
58

59
            sleep(1);
×
60
        }
61
    }
62

63
    /**
64
     * Send an event to the browser.
65
     */
66
    private function sendEvent(string $event, array $data): void
67
    {
68
        echo "event: {$event}\n";
×
69
        echo 'data: ' . json_encode($data) . "\n\n";
×
70

71
        ob_flush();
×
72
        flush();
×
73
    }
74
}
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