-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] silence PHP warnings issued by Redis::connect()
#58818
New issue 8000
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
[Messenger] silence PHP warnings issued by Redis::connect()
#58818
Conversation
how does error handling work for the connection then ? Are we still reporting failures properly ? |
Good point, proper error handling is missing for |
3af3822
to
38fd27e
Compare
you are right, I have updated the class with the same approach that we use in the Redis adapter as pointed out by @chalasr |
38fd27e
to
6613d26
Compare
Redis::connect()
6613d26
to
0769891
Compare
src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php
Outdated
Show resolved
Hide resolved
0769891
to
98ce163
Compare
} | ||
|
||
if (!$isConnected) { | ||
throw new InvalidArgumentException(sprintf('Redis connection failed: %s', preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? $redis->getLastError() ?? '', $matches) ? \sprintf(' (%s)', $matches[1]) : '')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new InvalidArgumentException(sprintf('Redis connection failed: %s', preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? $redis->getLastError() ?? '', $matches) ? \sprintf(' (%s)', $matches[1]) : '')); | |
throw new InvalidArgumentException('Redis connection failed: '.(preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? $redis->getLastError() ?? '', $matches) ? \sprintf(' (%s)', $matches[1]) : '')); |
98ce163
to
8ca27e1
Compare
Thank you @xabbuh. |
…ction issues (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [Cache] silence warnings issued by Redis Sentinel on connection issues | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT related to #58365 and #58818 see https://github.com/symfony/symfony/actions/runs/11936530431/job/33270392688#step:9:607 Commits ------- 97bdf94 silence warnings issued by Redis Sentinel on connection issues
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [symfony/debug-bundle](https://symfony.com) ([source](https://redirect.github.com/symfony/debug-bundle)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/doctrine-messenger](https://symfony.com) ([source](https://redirect.github.com/symfony/doctrine-messenger)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/dotenv](https://symfony.com) ([source](https://redirect.github.com/symfony/dotenv)) | `7.1.9` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/framework-bundle](https://symfony.com) ([source](https://redirect.github.com/symfony/framework-bundle)) | `7.1.6` -> `7.2.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/mailer](https://symfony.com) ([source](https://redirect.github.com/symfony/mailer)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/messenger](https://symfony.com) ([source](https://redirect.github.com/symfony/messenger)) | `7.1.9` -> `7.2.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/phpunit-bridge](https://symfony.com) ([source](https://redirect.github.com/symfony/phpunit-bridge)) | `7.1.9` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/runtime](https://symfony.com) ([source](https://redirect.github.com/symfony/runtime)) | `7.1.7` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/security-bundle](https://symfony.com) ([source](https://redirect.github.com/symfony/security-bundle)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/stopwatch](https://symfony.com) ([source](https://redirect.github.com/symfony/stopwatch)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/twig-bundle](https://symfony.com) ([source](https://redirect.github.com/symfony/twig-bundle)) | `7.1.6` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/ux-twig-component](https://symfony.com) ([source](https://redirect.github.com/symfony/ux-twig-component)) | `2.21.0` -> `2.22.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [symfony/web-profiler-bundle](https://symfony.com) ([source](https://redirect.github.com/symfony/web-profiler-bundle)) | `7.1.9` -> `7.2.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>symfony/debug-bundle (symfony/debug-bundle)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/debug-bundle/compare/v7.1.6...v7.2.0) [Compare Source](https://redirect.github.com/symfony/debug-bundle/compare/v7.1.6...v7.2.0) </details> <details> <summary>symfony/doctrine-messenger (symfony/doctrine-messenger)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/doctrine-messenger/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/doctrine-messenger/compare/v7.1.6...v7.2.0) **Changelog** (symfony/doctrine-messenger@v7.2.0-RC1...v7.2.0) - no significant changes </details> <details> <summary>symfony/dotenv (symfony/dotenv)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/dotenv/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/dotenv/compare/v7.1.9...v7.2.0) **Changelog** (symfony/dotenv@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#59007](https://redirect.github.com/symfony/symfony/issues/59007) \[Dotenv] read runtime config from composer.json in debug dotenv command ([@​xabbuh](https://redirect.github.com/xabbuh)) </details> <details> <summary>symfony/framework-bundle (symfony/framework-bundle)</summary> ### [`v7.2.1`](https://redirect.github.com/symfony/framework-bundle/releases/tag/v7.2.1) [Compare Source](https://redirect.github.com/symfony/framework-bundle/compare/v7.2.0...v7.2.1) **Changelog** (symfony/framework-bundle@v7.2.0...v7.2.1) - bug [symfony/symfony#59122](https://redirect.github.com/symfony/symfony/issues/59122) \[Notifier] fix desktop channel bus abstract arg ([@​raphael-geffroy](https://redirect.github.com/raphael-geffroy)) - bug [symfony/symfony#59124](https://redirect.github.com/symfony/symfony/issues/59124) \[FrameworkBundle] fix: notifier push channel bus abstract arg ([@​raphael-geffroy](https://redirect.github.com/raphael-geffroy)) - bug [symfony/symfony#59086](https://redirect.github.com/symfony/symfony/issues/59086) \[FrameworkBundle] Make uri_signer lazy and improve error when kernel.secret is empty ([@​nicolas-grekas](https://redirect.github.com/nicolas-grekas)) ### [`v7.2.0`](https://redirect.github.com/symfony/framework-bundle/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/framework-bundle/compare/v7.1.6...v7.2.0) **Changelog** (symfony/framework-bundle@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#58950](https://redirect.github.com/symfony/symfony/issues/58950) \[FrameworkBundle] Revert " Deprecate making `cache.app` adapter taggable" (@​keulinho) - bug [symfony/symfony#58943](https://redirect.github.com/symfony/symfony/issues/58943) \[FrameworkBundle] Revert " Don't auto-register form/csrf when the corresponding components are not installed" ([@​nicolas-grekas](https://redirect.github.com/nicolas-grekas)) - bug [symfony/symfony#58937](https://redirect.github.com/symfony/symfony/issues/58937) \[FrameworkBundle] Don't auto-register form/csrf when the corresponding components are not installed ([@​nicolas-grekas](https://redirect.github.com/nicolas-grekas)) - bug [symfony/symfony#58885](https://redirect.github.com/symfony/symfony/issues/58885) \[PropertyInfo]\[Serializer]\[TypeInfo]\[Validator] TypeInfo 7.1 compatibility ([@​mtarld](https://redirect.github.com/mtarld)) - bug [symfony/symfony#58834](https://redirect.github.com/symfony/symfony/issues/58834) \[FrameworkBundle] ensure `validator.translation_domain` parameter is always set (@​xabbuh) </details> <details> <summary>symfony/mailer (symfony/mailer)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/mailer/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/mailer/compare/v7.1.6...v7.2.0) **Changelog** (symfony/mailer@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#58888](https://redirect.github.com/symfony/symfony/issues/58888) \[Mailer]\[Notifier] Sweego is backing their bridges, thanks to them! ([@​nicolas-grekas](https://redirect.github.com/nicolas-grekas)) </details> <details> <summary>symfony/messenger (symfony/messenger)</summary> ### [`v7.2.1`](https://redirect.github.com/symfony/messenger/releases/tag/v7.2.1) [Compare Source](https://redirect.github.com/symfony/messenger/compare/v7.2.0...v7.2.1) **Changelog** (symfony/messenger@v7.2.0...v7.2.1) - no significant changes ### [`v7.2.0`](https://redirect.github.com/symfony/messenger/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/messenger/compare/v7.1.9...v7.2.0) **Changelog** (symfony/messenger@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#58952](https://redirect.github.com/symfony/symfony/issues/58952) \[Cache] silence warnings issued by Redis Sentinel on connection issues ([@​xabbuh](https://redirect.github.com/xabbuh)) - bug [symfony/symfony#58862](https://redirect.github.com/symfony/symfony/issues/58862) \[Notifier] Fix GoIpTransport ([@​nicolas-grekas](https://redirect.github.com/nicolas-grekas)) - bug [symfony/symfony#58818](https://redirect.github.com/symfony/symfony/issues/58818) \[Messenger] silence PHP warnings issued by `Redis::connect()` (@​xabbuh) </details> <details> <summary>symfony/phpunit-bridge (symfony/phpunit-bridge)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/phpunit-bridge/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/phpunit-bridge/compare/v7.1.9...v7.2.0) **Changelog** (symfony/phpunit-bridge@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#58828](https://redirect.github.com/symfony/symfony/issues/58828) \[PhpUnitBridge] fix dumping tests to skip with data providers ([@​xabbuh](https://redirect.github.com/xabbuh)) </details> <details> <summary>symfony/runtime (symfony/runtime)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/runtime/compare/v7.1.7...v7.2.0) [Compare Source](https://redirect.github.com/symfony/runtime/compare/v7.1.7...v7.2.0) </details> <details> <summary>symfony/security-bundle (symfony/security-bundle)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/security-bundle/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/security-bundle/compare/v7.1.6...v7.2.0) **Changelog** (symfony/security-bundle@v7.2.0-RC1...v7.2.0) - no significant changes </details> <details> <summary>symfony/stopwatch (symfony/stopwatch)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/stopwatch/compare/v7.1.6...v7.2.0) [Compare Source](https://redirect.github.com/symfony/stopwatch/compare/v7.1.6...v7.2.0) </details> <details> <summary>symfony/twig-bundle (symfony/twig-bundle)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/twig-bundle/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/twig-bundle/compare/v7.1.6...v7.2.0) **Changelog** (symfony/twig-bundle@v7.2.0-RC1...v7.2.0) - no significant changes </details> <details> <summary>symfony/ux-twig-component (symfony/ux-twig-component)</summary> ### [`v2.22.1`](https://redirect.github.com/symfony/ux-twig-component/compare/v2.22.0...v2.22.1) [Compare Source](https://redirect.github.com/symfony/ux-twig-component/compare/v2.22.0...v2.22.1) ### [`v2.22.0`](https://redirect.github.com/symfony/ux-twig-component/compare/v2.21.0...v2.22.0) [Compare Source](https://redirect.github.com/symfony/ux-twig-component/compare/v2.21.0...v2.22.0) </details> <details> <summary>symfony/web-profiler-bundle (symfony/web-profiler-bundle)</summary> ### [`v7.2.0`](https://redirect.github.com/symfony/web-profiler-bundle/releases/tag/v7.2.0) [Compare Source](https://redirect.github.com/symfony/web-profiler-bundle/compare/v7.1.9...v7.2.0) **Changelog** (symfony/web-profiler-bundle@v7.2.0-RC1...v7.2.0) - bug [symfony/symfony#58919](https://redirect.github.com/symfony/symfony/issues/58919) \[WebProfilerBundle] Twig deprecations ([@​mazodude](https://redirect.github.com/mazodude)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/Runroom/archetype-symfony). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuNTguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Redis::connect()
may issue a warning when the host cannot be resolved (see https://github.com/symfony/symfony/actions/runs/11755592846/job/32750804715?pr=58370#step:8:2535)