PHP 8 ?

PHP 7.4 is nearing end of life. Are there any plans to upgrade FuelCMS to be compatible with PHP 8?

Comments

  • It should already be compatible with 8. I updated the requirement in the docs.

  • Booting FuelCMS 1.5.1 on CodeIgniter 3.1.11 under PHP 8.0 leads to boot errors since config/fuel_modules.php tries to pass a module name as a string which doesn't seem allowed:

    An uncaught Exception was encountered
    
    Type: TypeError
    
    Message: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
    
    Filename: /public_html/fuel/modules/fuel/libraries/Fuel_modules.php
    
    Line Number: 205
    
    Backtrace:
    
    File: /public_html/fuel/modules/fuel/libraries/Fuel_modules.php
    Line: 205
    Function: get_parent_class 
    

    This breaking change is described in the PHP documentation for get_parent_class() so I don't think FuelCMS is quite compatible unless there's an alternative way of passing references to these classes or a change in the way they're instantiated, maybe using reflection or with their fully qualified names as described in this StackOverflow post.

  • Ok, so this looks to have been updated only in the develop branch but not in any release, is that correct?

    In 1.5.1, the Fuel_modules#add() method uses get_parent_class incorrectly (for PHP 8.0):

    if (file_exists($file_path))
                {
                    // class must extend the fuel_module class to be legit
                    if (strtolower(get_parent_class($class_name)) == 'fuel_module')
                    {
                        $this->CI->load->module_library($init['folder'], strtolower($class_name));
                        $fuel_module =& $this->CI->$class_name;
                    }
                }
    

    Whereas in develop the same method no longer uses get_parent_class:

    if (file_exists($file_path))
                {
                    // class must extend the fuel_module class to be legit
                    //if (strtolower(get_parent_class($class_name)) == 'fuel_module')
                    if (is_subclass_of($class_name, 'Fuel_module'))
                    {
                        $this->CI->load->module_library($init['folder'], strtolower($class_name));
                        $fuel_module =& $this->CI->$class_name;
                    }
                }
    

    @admin would it be possible to release an alpha of what's currently in develop for testing under PHP 8.0 perhaps?

  • I just published a 1.5.2 that has the contents of the develop branch. You can also just download/merge in the develop branch to your code.

  • Thanks @admin I'll give it a try. Have a nice weekend 🙂

  • Actually... wait a bit. There are some issues with the login cookie due to a CI change. Should have a fix later today I hope.

  • OK... I think I have that resolved.

  • Tested on a brand new install with PHP 8.1 and so far everything worked great. Thanks!

  • This discussion is very positive. I'm glad it has become public on this forum.

Sign In or Register to comment.