leibniz-psychology / openid

OpenId plugin for OJS, OMP, OPS 3.x
https://www.psychopen.eu/
GNU General Public License v3.0
9 stars 12 forks source link

Plugin throws an error on logout when used with PHP 8.1 #28

Open felixhelix opened 1 year ago

felixhelix commented 1 year ago

Describe the bug When the plugins is active and a user logs out a blank page is shown and an error message logged.

To Reproduce Steps to reproduce the behavior:

  1. Logout
  2. See blank page

What application are you using? OPS version 3.3.0.8, PHP 8.1.14, Plugin Version

Additional information

Error message

[php:error] [pid 8516] [client 134.95.147.149:32884] PHP Fatal error: Uncaught TypeError: array_shift(): Argument #1 ($array) must be of type array, Journal given in /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php:485

Stack trace:
#0 /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php(485): array_shift()
#1 /var/www/html/lib/pkp/classes/core/PKPPageRouter.inc.php(260): PKPRouter->_urlGetBaseAndContext()
#2 /var/www/html/lib/pkp/classes/core/Dispatcher.inc.php(167): PKPPageRouter->url()
#3 /var/www/html/lib/pkp/classes/core/PKPRequest.inc.php(659): Dispatcher->url()
#4 /var/www/html/plugins/generic/openid/handler/OpenIDLoginHandler.inc.php(182): PKPRequest->redirect()
#5 /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php(395): OpenIDLoginHandler->signOut()
#6 /var/www/html/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest()
#7 /var/www/html/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route()
#8 /var/www/html/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch()
#9 /var/www/html/index.php(67): PKPApplication->execute()
#10 {main}\n  thrown in /var/www/html/lib/pkp/classes/core/PKPRouter.inc.php on line 485, referer: ...
LalitoAlva commented 1 year ago

Does anyone has an answer to this??

felixhelix commented 8 months ago

I figured out that the redirect request in line 182 in openid/handler/OpenIDLoginHandler.inc.php needs to be changed to $request->redirect(Application::get()->getRequest()->getRequestedContextPath(), 'index'); to make it work.