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
System plugin redirect expect deprecated JException, throw fatal error when sent an Exception object #9635
Comments
Can you send your changes as pull request so it can be tested? |
The redirect plugin is supposed to have two handlers now, Given this looks like a theoretical issue (changing internals of JError to reproduce an issue), can you provide a functional code demo that triggered the incorrect behavior? |
Hi Michael, It's not theoretical, but it involves other extensions in real life, so the example above was meant to reproduce only with Joomla. I see now that I have not yet identified the whole process involved. I'll dig more and come back with appropriate details, or close the issue if not relevant. Thanks for your quick handling Yannick |
For reference #9270 explains why |
Hi Michael After further research, this issue (in sh404SEF) is indeed caused by the change in signature of the handleError() method in #9270:
Under some (rare) circumstances, we create an Exception object, but use call_user_func_array downstream to send that Error to the Joomla error handler. This was good before, but now that handleError() requires a JException, it fails. Any reason to use the deprecated JException in that signature over the regular Exception? Thanks |
Because that error handler is now very explicitly set to only catch Ultimately both call the same private function so there's no functional difference, just more of a declaration difference than anything. |
Hi I'm very fine with the split, just not sure handleError() will always be called with a JException, which is why a Exception type hint may be safer. Anyway, I can handle this situation at extension level, so there's no need to actually push that PR from where I stand. It'd be safer I feel, but I can handle on my side, as said. Rgds |
Well, |
Fine with me ;) closing this issue |
This sounds like an issue being created by something in virtumart and not
in the core of joomla. Please ask at forum.virtumart.net or forum.joomla.org
|
I have the same error from new user registrations. When the site admin clicks the approval link within the email, the site displays blank white page. When error reporting enabled, get the below error message. Joomla 3.5.1 Catchable fatal error: Argument 1 passed to PlgSystemRedirect::handleError() must be an instance of JException, instance of phpmailerException given in /path2site/mydomain.com/plugins/system/redirect/redirect.php on line 55 It's 3 months later from last post, can anyone provide a fix for this without updating to joomla 3.6? |
Always update!!
|
Thank you. Had I posted last week (prior to 3.6.0 release) what would the answer be? |
Hi @xristoph Just disable the redirect system plugin. It has no effect with sh404SEF enabled anyway. Rgds |
Okay, thank you @weeblr greatly appreciated |
You're welcome. Note however that this means you have a 404 on this page, so that's something you have to address. Rgds |
And that's what the answer would have been (or stop using sh404 :) ) |
Steps to reproduce the issue
This is a coding issue, needs code to be reproduced.
In /libraries/legacy/error/error.php, at line 177 (J! 3.5.0), replace
$exception = new JException($msg, $code, $level, $info, $backtrace);
with
$exception = new Exception($msg, $code, $level, $info, $backtrace);
Then select a link to an article, unpublish that article and visit the front end link.
Expected result
The Joomla 404 error page.
Actual result
Fatal error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]]) in xxxxxxxx/libraries/legacy/error/error.php on line 178
System information (as much as possible)
Joomla 3.5.0, system is irrelevant
Additional comments
This comes from /plugins/system/redirect/redirect.php, at line 55: the handlerError() method signature is:
public static function handleError(JException &$error)
while it should be:
public static function handleError(Exception &$error)
As JException is deprecated, and has been for a while, we should not be forced to use it.
The only fix currently is to disable the plugin when an extension throws Exception (the recommended Joomla API to use) instead of the legacy JException.
Rgds
The text was updated successfully, but these errors were encountered: