From ca1e7190f02afd2946e2cfae7e2c66e8c6829354 Mon Sep 17 00:00:00 2001 From: iturgeon Date: Thu, 27 Oct 2022 01:07:48 +0200 Subject: [PATCH] PHP 8.1 compatability when phpunit autoload file doesnt exit oil attempts to load phpunits autoload file, ignoring failures if it isn't able to load the file. The code was using the @ operator to supress errors in loading the file. This change will check if the file exists as a gate in front of loading it, which will prevent the error that is no longer supressed in php 8.1 --- classes/command.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/command.php b/classes/command.php index 86ea21d..cc8e54b 100644 --- a/classes/command.php +++ b/classes/command.php @@ -181,7 +181,10 @@ public static function init($args) // Suppressing this because if the file does not exist... well thats a bad thing and we can't really check // I know that supressing errors is bad, but if you're going to complain: shut up. - Phil $phpunit_autoload_path = \Config::get('oil.phpunit.autoload_path', 'PHPUnit/Autoload.php' ); - @include_once $phpunit_autoload_path; + if (file_exists($phpunit_autoload_path)) + { + include_once $phpunit_autoload_path; + } // Attempt to load PHUnit. If it fails, we are done. if ( ! $is_phar and ! (class_exists('PHPUnit_Framework_TestCase') or class_exists('PHPUnit\Framework\TestCase')))