[Bug]: Application Logger ENUM + 0 Returns Float in MySQL, Causes Type Mismatch in Doctrine DBAL Integer
Pimcore version
12.0.1
Steps to reproduce
Open PIMCore Admin, open Application Logs
Message: Pimcore\Bundle\ApplicationLoggerBundle\Service\TranslationService::getTranslatedLogLevel(): Argument #1 ($key) must be of type int, float given, called in /var/www/html/demo/vendor/pimcore/pimcore/bundles/ApplicationLoggerBundle/src/Controller/LogController.php on line 135 Trace: in /var/www/html/demo/vendor/pimcore/pimcore/bundles/ApplicationLoggerBundle/src/Service/TranslationService.php:42 #0 /var/www/html/demo/vendor/pimcore/pimcore/bundles/ApplicationLoggerBundle/src/Controller/LogController.php(135): Pimcore\Bundle\ApplicationLoggerBundle\Service\TranslationService->getTranslatedLogLevel() #1 /var/www/html/demo/vendor/symfony/http-kernel/HttpKernel.php(181): Pimcore\Bundle\ApplicationLoggerBundle\Controller\LogController->showAction() #2 /var/www/html/demo/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #3 /var/www/html/demo/vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle() #4 /var/www/html/demo/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\Component\HttpKernel\Kernel->handle() #5 /var/www/html/demo/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() #6 /var/www/html/demo/public/index.php(20): require_once('...') #7 {main}
Actual Behavior
Try to open Application logger and it throws error "Internal Server Error" Status 500
Expected Behavior
Try to open Application logger and it should not throw any error and display all the application logs.
@kingjia90 pls look into it.
Thank you for reporting!
@mcop1 worked on that refactoring, so i guess he may know better.
Would it be better to replace the + 0 query side with a php cast on https://github.com/pimcore/pimcore/blob/7f1898e7a538edead0e5ddc3246d75b3656b7a92/bundles/ApplicationLoggerBundle/src/Controller/LogController.php#L135
Opened a PR to fix it https://github.com/pimcore/pimcore/pull/18491
Thank you for reporting! @mcop1 worked on that refactoring, so i guess he may know better. Would it be better to replace the
+ 0query side with a php cast onpimcore/bundles/ApplicationLoggerBundle/src/Controller/LogController.php
Line 135 in 7f1898e 'priority' => $translationService->getTranslatedLogLevel($row['priority_key']),
Had a quick look and it works for me in both MariaDB as well as MySql. Guess it depends on some specific settings then.
Thanks for fixing it!
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.
Fixed by https://github.com/pimcore/pimcore/pull/18491