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

Throw exception if file not found #22

Open
schlessera opened this issue Apr 7, 2017 · 3 comments
Open

Throw exception if file not found #22

schlessera opened this issue Apr 7, 2017 · 3 comments

Comments

@schlessera
Copy link
Member

Some file operations silently fail if the file to act upon does not exist.

I should look into whether it makes sense to throw exceptions in that case. Or is the current behaviour of returning an empty array/Config the safer approach?

@tyrann0us
Copy link

Hi @schlessera, not sure if this is the correct issue to attach to, but on PHP 8.1, we get this:

Deprecated: is_readable(): Passing null to parameter #1 ($filename) of type string is deprecated in /var/www/html/vendor/brightnucleus/config/src/ConfigFactory.php on line 60

I haven't checked yet why the passed file is null. Is there any chance you could fix this?
Please let me know if I should create a new issue for this.
Thanks!

@GaryJones
Copy link

@tyrann0us Can you find where you might be calling ConfigFactory:: createFromFile(...) or ConfigFactory:: create(...) or ConfigFactory:: createSubConfig(...) and determine what the passed arguments are? Alain would need to know how the package code is being used to determine where the best place for a fix would be.

@shvlv
Copy link

shvlv commented Oct 20, 2022

Hi @schlessera it seems the warning is unrelated to the current issue but it's related to the https://github.com/brightnucleus/view/blob/275d9fc3eab6ade6c6e192a15d7a81d9aee95a8b/src/View/ViewBuilder.php#L330
$config has null|ConfigInterface in fact while ConfigFactory::create expects array of strings if arguments number more than 1.

So if you just run \BrightNucleus\Views::getViewBuilder you will get Deprecated: is_readable(): Passing null to parameter #1 ($filename) of type string is deprecated in PHP 8.

It's hard for me to get why $config is passed to the ConfigFactory::create. Maybe it could be just removed...

cc @tyrann0us


Small offtopic. We used brightnucleus set of libraries for a long time but it seems a bit abandoned. What is their future?

Anyway, thanks a lot @schlessera for your excellent job!

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

No branches or pull requests

4 participants