-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Exception to Throwable in Mage_Core_Block_Template. #2623
Convert Exception to Throwable in Mage_Core_Block_Template. #2623
Conversation
I'm not sure, but this create a new problem. With a fresh installation of OpenMage without any changes, developer mode disabled, log enabled, PHP 8.0. With
With
Solution seems to add (not sure): } catch (Throwable $e) {
if (!$do) { // here
ob_get_clean();
$do = true; // here
}
if (Mage::getIsDeveloperMode()) {
throw $e;
}
Mage::logException($e);
} |
There is another problem, YES NOT SAME. Create an error in An incomplete solution is to change in Mage.php for diff --git a/app/Mage.php b/app/Mage.php
@@ -741,7 +738,7 @@ final class Mage
} catch (Mage_Core_Model_Store_Exception $e) {
require_once(self::getBaseDir() . DS . 'errors' . DS . '404.php');
die();
- } catch (Exception $e) {
+ } catch (Throwable $e) {
if (self::isInstalled()) {
self::printException($e);
exit();
Then, instead of a blank page, the error report page is displayed, and a report is created. |
But if you read the error report, it is "incomplete". This fix the problem (but not fully tested): diff --git a/app/Mage.php b/app/Mage.php
@@ -968,11 +965,13 @@ final class Mage
print $e->getMessage() . "\n\n";
print $e->getTraceAsString();
+ print "\n" . ' thrown in <b>' . $e->getFile() . '</b> on line <b>' . $e->getLine() . '</b>' . "\n" . ' catched by Mage::printException()';
print '</pre>';
} else {
$reportData = [
(!empty($extra) ? $extra . "\n\n" : '') . $e->getMessage(),
- $e->getTraceAsString()
+ $e->getTraceAsString() .
+ "\n" . ' thrown in ' . $e->getFile() . ' on line ' . $e->getLine() . "\n" . ' catched by Mage::printException()'
];
// retrieve server data |
If it is an issue we should investigate it. I will allocate time for it. |
@luigifab can you please open new issues for this? |
Description (*)
This will save some hours for developers, which need to see exceptions. Without this change, a whole class of errors are not caught. See discussion #2606.
Related Pull Requests
PR #1442 is not going to be merged anytime soon, so why not fix this file first.