Skip to content
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

RememberMe not working with only PostgreSQL #4441

Closed
ulfkosack opened this issue Jul 13, 2021 · 0 comments · Fixed by #4467
Closed

RememberMe not working with only PostgreSQL #4441

ulfkosack opened this issue Jul 13, 2021 · 0 comments · Fixed by #4467
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ulfkosack
Copy link

Describe the bug

After Login with active switch RememberMe the following stacktrace is shown

Uncaught Error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /usr/share/php/Icinga/Common/Database.php:37
Stack trace:
#0 /usr/share/php/Icinga/Web/RememberMe.php(224): Icinga\Web\RememberMe->getDb()
#1 /usr/share/icingaweb2/application/forms/Authentication/LoginForm.php(142): Icinga\Web\RememberMe->persist()
#2 /usr/share/php/Icinga/Web/Form.php(1178): Icinga\Forms\Authentication\LoginForm->onSuccess()
#3 /usr/share/icingaweb2/application/controllers/AuthenticationController.php(83): Icinga\Web\Form->handleRequest()
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Controllers\AuthenticationController->loginAction()
#5 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('loginAction')
#6 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#7 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispat

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

To Reproduce

Use an Icingaweb2 instance with only postgresql-database-backend.

  1. Input Username
  2. Input Password
  3. Activate "Stay logged in"
  4. Press Button Login

Expected behavior

I'm successfully logged in

Screenshots

Table is created via /usr/share/icingaweb2/etc/schema/pgsql-upgrades/2.9.0.sql
grafik

Your Environment

Loaded Libraries
Name 	Version
icinga/icinga-php-library 	0.6.0
icinga/icinga-php-thirdparty 	0.10.0
Loaded Modules
Name 	Version
director 	1.8.0
incubator 	0.6.0
ipl 	v0.5.0
monitoring 	2.9.0
nordlicht 	1.0.0
reactbundle 	0.9.0
spring 	0.0.1 

icinga2 - The Icinga 2 network monitoring daemon (version: r2.12.4-1)

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
System information:
  Platform: Debian GNU/Linux
  Platform version: 10 (buster)
  Kernel: Linux
  Kernel version: 4.19.0-17-amd64
  Architecture: x86_64
PHP 7.3.29-1~deb10u1 (cli) (built: Jul  2 2021 04:04:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.29-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

Without the switch I can login, but get this message on logout:

Uncaught Error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /usr/share/php/Icinga/Common/Database.php:37
Stack trace:
#0 /usr/share/php/Icinga/Web/RememberMe.php(83): Icinga\Web\RememberMe->getDb()
#1 /usr/share/icingaweb2/application/controllers/AuthenticationController.php(111): Icinga\Web\RememberMe::fromCookie()
#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Controllers\AuthenticationController->logoutAction()
#3 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('logoutAction')
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#5 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#6 /usr/share/php/Icinga/Application/webrouter.php(107): Icinga\Application\Web->dispatch()
#7 /usr/share/icingaweb2/public/index.php(4): requ

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

Additional context

Discussed on Icinga Forum https://community.icinga.com/t/web-2-9-rememberme-undefined-class-constant-mysql-attr-init-command/7754

@nilmerg nilmerg added the bug Something isn't working label Jul 14, 2021
@nilmerg nilmerg changed the title Web 2.9 RememberMe Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND’ RememberMe not working with only PostgreSQL Jul 14, 2021
@nilmerg nilmerg self-assigned this Jul 21, 2021
@nilmerg nilmerg added this to the 2.9.1 milestone Jul 27, 2021
nilmerg added a commit that referenced this issue Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants