pimcore icon indicating copy to clipboard operation
pimcore copied to clipboard

[Bug]: Application Logger ENUM + 0 Returns Float in MySQL, Causes Type Mismatch in Doctrine DBAL Integer

Open amitmalakar-2022 opened this issue 6 months ago • 4 comments

Pimcore version

12.0.1

Steps to reproduce

Open PIMCore Admin, open Application Logs

Image

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

Image

Expected Behavior

Try to open Application logger and it should not throw any error and display all the application logs.

amitmalakar-2022 avatar Jun 17 '25 06:06 amitmalakar-2022

@kingjia90 pls look into it.

amitmalakar-2022 avatar Jun 17 '25 09:06 amitmalakar-2022

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

kingjia90 avatar Jun 17 '25 09:06 kingjia90

Opened a PR to fix it https://github.com/pimcore/pimcore/pull/18491

kingjia90 avatar Jun 17 '25 10:06 kingjia90

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

pimcore/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!

mcop1 avatar Jun 17 '25 11:06 mcop1

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.

github-actions[bot] avatar Jul 07 '25 07:07 github-actions[bot]

Fixed by https://github.com/pimcore/pimcore/pull/18491

kingjia90 avatar Jul 09 '25 07:07 kingjia90