Skip to content
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ permissions:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2', '8.3']

steps:
Expand Down
10 changes: 9 additions & 1 deletion src/OriginDetection.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ public function parseCgroupNodePath($lines)

public function getCgroupInode($cgroupMountPath, $procSelfCgroupPath)
{
$cgroupControllersPaths = $this->parseCgroupNodePath(file_get_contents($procSelfCgroupPath));
// phpcs:disable
$content = @file_get_contents($procSelfCgroupPath);
// phpcs:enable
if ($content == false) {
return '';
}

$cgroupControllersPaths = $this->parseCgroupNodePath($content);

foreach ([self::CGROUPV1BASECONTROLLER , ''] as $controller) {
if (!isset($cgroupControllersPaths[$controller])) {
Expand Down Expand Up @@ -111,6 +118,7 @@ private function parseContainerID($handle)
$expContainerID = '/(' . $uuidSource . '|' . $containerSource . '|' . $taskSource . ')(?:.scope)?$/';

while (($line = fgets($handle)) !== false) {
$line = rtrim($line);
if (preg_match($expLine, $line, $matches)) {
if (count($matches) != 2) {
continue;
Expand Down
Loading