Jump to content

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


panormitis
 Share

Recommended Posts

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); }

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

2 hours ago, 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. 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...