John Heenan Posted December 18, 2022 Report Share Posted December 18, 2022 Setting PHP debug in Blesta 5.6.0 editing config/blesta.php to below // PHP error_reporting. 0 to disable error reporting, -1 to to show all errors // Consult php's documentation for additional options Configure::errorReporting(-1); // Override minPHP's debugging setting. true to enable debugging, false to disable it Configure::set('System.debug', true); always results in error message starting with below in browser, making Blesta unsuable with PHP debug. Something went wrong. Return type of Minphp\Session\Handlers\PdoHandler::open($savePath, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice. Return type of Minphp\Session\Handlers\PdoHandler::open($savePath, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice on line 65 in ...../blesta/vendors/minphp/session/src/Handlers/PdoHandler.php UnknownException::setErrorHandler Line 232 ...../blesta/vendors/monolog/monolog/src/Monolog/ErrorHandler.php Monolog\ErrorHandler->handleError Line 10 Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 18, 2022 Author Report Share Posted December 18, 2022 Additional Information: Blesta version 5.6.0 using ioncube-loader for PHP 8.1 PHP version: 8.1.13 MySQL version: MariaDB 10.3.35 Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 22, 2022 Author Report Share Posted December 22, 2022 This problem was originally reported for Blesta beta version 5.6.0-b2. Blesta 5.6.0 has now been released. I upgraded to 5.6.0 as per recommended for a new release (overwrite all files). The problem and reporting remain the same. PHP debug is unusable because Minphp reports a type error. I assume this is due to tightening up with PHP 8. Hence I have edited the topic and contents to remove the '-b2' beta suffix. Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 23, 2022 Author Report Share Posted December 23, 2022 If this bug is due to some additional type checking in PHP 8.1, maybe we can be told of some global setting to turn this off so we can get past this unhelpful message that obstructs debugging I don't know where the instruction #[\ReturnTypeWillChange] is supposed to go and if this is a global setting or not. Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 23, 2022 Author Report Share Posted December 23, 2022 I have found a global fix for this bug. The fix implies Blesta 5.6.0, when used with PHP 8.1, is using deprecated code. This is not surprising and is considered normal for large projects. There is no urgency about fixing this. Here is the fix that enables PHP debug to be used with Blesta 5.6.0 and PHP 8.1 edit config/blesta.php and use Configure::errorReporting(E_ALL & ~E_DEPRECATED); instead of the current recomendation of Configure::errorReporting(-1); Note the spelling of E_DEPRECATED is correct Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 23, 2022 Author Report Share Posted December 23, 2022 Below is in a php.ini file for my server that I dd not alter. ; Default Value: E_ALL │ ; Development Value: E_ALL │ ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT │ ; https://php.net/error-reporting │ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT What it means is that if you want to use the last configured error_reporting php.ini value then you need to comment out the following lines in conf/blesta.php Configure::errorReporting(0); E_ALL is equivalent to -1 Quote Link to comment Share on other sites More sharing options...
John Heenan Posted December 23, 2022 Author Report Share Posted December 23, 2022 Some more information about error reporting with Blesta. This clears up confusion for me. Errors are reported to screen, even with display_errors set to off, as errors are trapped by file app/views/errors/error.pdt The boolean internal variable System.Debug decides whether error.pdt includes a stack trace or not To make sure no errors are visible error_reporting must be set to 0, such as by using Configure::errorReporting(0); Errrors are also logged to various files in logs_blesta directory Amit Kumar Mishra 1 Quote Link to comment Share on other sites More sharing options...
Amit Kumar Mishra Posted January 5, 2023 Report Share Posted January 5, 2023 Hi @johnhe i like your passion even without any response from the community, you could resolve it not only that you contributed to the community by answering to its fix keep up the good work John Heenan 1 Quote Link to comment Share on other sites More sharing options...
John Heenan Posted January 5, 2023 Author Report Share Posted January 5, 2023 6 hours ago, Amit Kumar Mishra said: Hi @johnhe i like your passion even without any response from the community, you could resolve it not only that you contributed to the community by answering to its fix keep up the good work Thanks! Amit Kumar Mishra 1 Quote Link to comment Share on other sites More sharing options...
AlexG Posted September 2, 2023 Report Share Posted September 2, 2023 On 12/23/2022 at 4:31 AM, johnhe said: I have found a global fix for this bug. The fix implies Blesta 5.6.0, when used with PHP 8.1, is using deprecated code. This is not surprising and is considered normal for large projects. There is no urgency about fixing this. Here is the fix that enables PHP debug to be used with Blesta 5.6.0 and PHP 8.1 edit config/blesta.php and use Configure::errorReporting(E_ALL & ~E_DEPRECATED); instead of the current recomendation of Configure::errorReporting(-1); Note the spelling of E_DEPRECATED is correct you save me ❤️ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.