Giter Site home page Giter Site logo

Comments (4)

lcharette avatar lcharette commented on June 1, 2024 1

Per PHP.net, An E_WARNING level error is generated if filename cannot be found. That warning doesn't seem to be caught by UF, so it should just end up in the PHP error log.

FYI, most PHP install will suppress E_WARNING by default. try/catch doesn't work because a warning is not an exception, so there's no way to handle this, only the false return type.

from userfrosting.

lcharette avatar lcharette commented on June 1, 2024 1

I fixed this in userfrosting/framework@4bfc0fc on the V5 branch. A FileNotFoundException will be thrown if the path is not found, as shown in new test. Note the path can still be null without an exception being thrown.

I don't plan on fixing for V4, but a PR would be considered.

from userfrosting.

lcharette avatar lcharette commented on June 1, 2024

file_get_contents should return false :

The function returns the read data or false on failure.

Which should throw an exception in YamlFileLoader
https://github.com/userfrosting/framework/blob/80bb8080506c16431a5e81080fafc301d3dc1e35/src/Support/Repository/Loader/YamlFileLoader.php#L31-L33

You could test it manually using

$loader = new YamlFileLoader('BadDirectory/ThisIsNotARealFile.yaml');
$items = $loader->load();

and post the result.

from userfrosting.

lcharette avatar lcharette commented on June 1, 2024

I think RequestSchema should load with the $skipMissing flag as false here :
https://github.com/userfrosting/framework/blob/80bb8080506c16431a5e81080fafc301d3dc1e35/src/Fortress/RequestSchema.php#L42

$skipMissing is true by default here :
https://github.com/userfrosting/framework/blob/80bb8080506c16431a5e81080fafc301d3dc1e35/src/Support/Repository/Loader/FileRepositoryLoader.php#L78-L82

And won't throw an exception here :
https://github.com/userfrosting/framework/blob/80bb8080506c16431a5e81080fafc301d3dc1e35/src/Support/Repository/Loader/FileRepositoryLoader.php#L53

Moving it to false would be a big change that could impact other system though. I should probably test for this situation on the V5 branch.

from userfrosting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.