Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.1 compatability when phpunit autoload file doesnt exit #272

Open
wants to merge 1 commit into
base: 1.9/develop
Choose a base branch
from

Conversation

iturgeon
Copy link

Oil attempts to load phpunit's autoload file, ignoring failures if it isn't able to load the file. The code is currently using the @ operator to suppress errors in loading the file.

Here's the error caused by running phpUnit on https://github.com/ucfopen/Materia on php 8.1

Uncaught exception Fuel\Core\PhpErrorException: 2 - include_once(PHPUnit/Autoload.php): Failed to open stream: No such file or directory in /var/www/html/fuel/packages/oil/classes/command.php on line 184

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 suppressed in php 8.1

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
@sonarcloud
Copy link

sonarcloud bot commented Oct 26, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell E 47 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@iturgeon
Copy link
Author

Whew, code smell red flags all over the existing code. @WanWizard I'd be happy to fix those in another PR if that's desirable?

@iturgeon
Copy link
Author

As an alternative, I was able to work around the error by setting the config for oil.phpunit.autoload_path to a file that can be loaded.

@WanWizard
Copy link
Member

Sorry for the late reply, Covid finally caught up with me, feeling rather poorly.

Most of the "code smells" are related to "Move this open curly brace to the end of the previous line", which is a Fuel code standard. So SonarCloud needs tweaking at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants