John Davidson

php - ini_set() is not blocked, yet I get "Warning: ini_set() has been disabled for security reasons"

0 comments
Message:


I've been banging my head for hours for this strange issue. My Magento shows me the error:


Exception #0 (Exception): Warning: ini_set() has been disabled for security reasons 
/path/to/vendor/magento/framework/Session/SessionManager.php
on line 598

Here's what line 598 looks like:


598: $result = ini_set('session.use_only_cookies', '1');

Here comes the strange part. When I add following just above this line 598:


597: echo ini_get('disable_functions');die;
598: $result = ini_set('session.use_only_cookies', '1');

I get this:


passthru,shell_exec,system

There's no ini_set in this list of disabled functions, yet somehow Magento manages to consider it blocked for "Security Reasons"...


I have checked all possible PHP configurations on the server. ini_set() is NOT blocked anywhere. This is giving me a tough time.


What's going on?




Edit 1


I created a test script, outside Magento with the following:


var_dump(ini_set('display_errors', 'Off'));
var_dump(ini_get('display_errors') );

Here's what I get whatever ini value I set...


NULL string(0) ""


My Answer:
It seems like the issue might be specific to Magento and how it handles certain functions like ini_set(). It's possible that Magento has its own security measures in place that are preventing the use of ini_set() for certain configurations.

One possible solution could be to try and find an alternative way to achieve the same result without using ini_set(). You could try looking into Magento's documentation or forums to see if there are any recommended approaches for setting session configurations.

Additionally, you could try reaching out to Magento's support team or community for further assistance in troubleshooting this issue. They may have more insights or suggestions on how to resolve the warning message.

Rate this post

5 of 5 based on 8192 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us