You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (false !== ($i = strpos($uri, '\\')) && $i < strcspn($uri, '?#')) {
thrownewBadRequestException('Invalid URI: A URI cannot contain a backslash.');
}
Backslashes are used by the bundle in the transaction name, which is composed from the class name of the message, and the class name uses backslashes for the namespace:
…24Fixes#24
Fix exception thrown using the Symfony profiler for Messenger workers
* Replace backslashes with regular slashes in the transaction name in `src/EventListener/MessengerProfilerListener.php`
* Use `str_replace('\\', '/', \get_class($event->getEnvelope()->getMessage()))`
* Replace backslashes with regular slashes in the transaction name in `src/Messenger/ProfilerMiddleware.php`
* Use `str_replace('\\', '/', \get_class($envelope->getMessage()))`
* Ensure the transaction name is used in the URI with regular slashes in `src/Profiler/SymfonyProfiler.php`
* Replace backslashes with regular slashes in the URI
---
For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/sourceability/instrumentation/issues/24?shareId=XXXX-XXXX-XXXX-XXXX).
Hello,
Listening to Symfony Messenger workers raises a
BadRequestException
fromSymfony\Component\HttpFoundation\Request
.It seems to be due to the introduction of a rejection of some characters in the URIs, including backslashes, by the Request class of the HTTPFoundation component:
symfony/http-foundation@32310ff#diff-de5d8eb3f1d6537c947f70e0a4673779312a902c083739f472c709c037bcbc30R370
Backslashes are used by the bundle in the transaction name, which is composed from the class name of the message, and the class name uses backslashes for the namespace:
instrumentation/src/EventListener/MessengerProfilerListener.php
Line 37 in e33e7be
instrumentation/src/Messenger/ProfilerMiddleware.php
Line 32 in e33e7be
Then the
SymfonyProfiler
uses the transaction name in the URI:instrumentation/src/Profiler/SymfonyProfiler.php
Line 48 in e33e7be
And creates the Request:
instrumentation/src/Profiler/SymfonyProfiler.php
Line 50 in e33e7be
I suggest fixing it by replacing the backslashes in the class name with regular slashes:
The text was updated successfully, but these errors were encountered: