Jump to content

If ini_set is disabled in PHP 8.1, it prevents Blesta from working


Recommended Posts

Posted

Technically I guess it's not really a bug, but since a disabled function in PHP 8.1 becomes pretty much non existent, it raises a fatal error and prevents Blesta from working.

So I commented out line 78 of the file ...vendors/minphp/session/src/Session.php and added another bellow it.

//              ini_set('session.' . $key, $value);
                if (function_exists('ini_set')) { ini_set('session.' . $key, $value); }

Posted

That would be the case in other versions of PHP if ini_set is in the disabled_functions list, correct?  (though disabling that function would break a ton of other scripts like Wordpress)  Good defensive coding doesn't hurt though. 

Posted
  On 7/13/2022 at 2:28 PM, steven99 said:

That would be the case in other versions of PHP if ini_set is in the disabled_functions list, correct?  (though disabling that function would break a ton of other scripts like Wordpress)  Good defensive coding doesn't hurt though. 

Expand  

On PHP 8.0/8.1 disabled functions are treated as nonexistent so a fatal error occurs.

On earlier PHP versions, disabled functions raise just a warning and the script continues to work.

I believe this should be addressed in Blesta, some functions could be disabled so they should be checked with function_exists() first.

Posted

ini_set is called throughout Blesta and in vendor code for legitimate reasons. In your case, /vendors/minphp/session/src/Session.php ini_set is used to set session variables. As far as I know, this has not changed recently, so it may be that a change to PHP 8 is responsible. We would probably recommend not disabling ini_set, but @Jono may be able to take a look when he has some time.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...