Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Autoloader issues on PHP7.1
  • Hi,

    I think I've found another issue after deployment of an app to server working under PHP7.1

    In the APP folder I have structure like this:

    /app/classes/controllers/
    /app/classes/SomeHelperClass.php
    /app/classes/OtherHelperClass.php
    /app/classes/SomeNamespace/classa.php
    /app/classes/SomeNamespace/classb.php
    /app/classes/SomeOtherNamespace/client.php
    ...

    Now, SomeHelperClass and OtherHelperClass sit in the global namespace so in the code :

    \OtherHelperClass::some_simple_method();

    Accessing clasess from other dirs works as well:

    \SomeNamespace\ClassA::some_method();

    After migtation to PHP7.1 it doesn't work.

    The quick workaround is to add all the classes to the autoloader in application's bootstrap file, but it may be a bit of pain with large number of classes.

  • Any error messages? Or other helpful info?
  • The only error message is that PHP can't find requested class.

    PS. I can provide you with some sample code if that's any help.
  • Ok.

    I really need a php 7.1 setup now...
  • HarroHarro
    Accepted Answer
    Wait a sec:

    SomeHelperClass.php is an illegal filename, Fuel requires all files to be lowercase. See https://docs.fuelphp.com/general/coding_standards.html under "File Naming".

    You could get away with a filename like this on Windows (because the filesystem is case insensitive), but not in Linux (and MacOS depending on the configuration).
  • You're right, that fixed the issue.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion