forked from symfony/symfony
-
Notifications
You must be signed in to change notification settings - Fork 3
[Process] Fix signaling/stopping logic on Windows #2
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2b672f4
to
8012731
Compare
8012731
to
9afbea2
Compare
nicolas-grekas
pushed a commit
that referenced
this pull request
Jan 14, 2016
[Serializer] Use $context['cache_key'] to enhance caching
nicolas-grekas
pushed a commit
that referenced
this pull request
Jan 14, 2016
…ble data (dunglas, nicolas-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [Serializer] Allow context to contain not serializable data | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Allow the context to contain not serializable data even for the `ObjectNormalizer` (BC break fix). Commits ------- 996f69d Merge pull request #2 from nicolas-grekas/ser-cache 8560c13 [Serializer] Use $context['cache_key'] to enhance caching c1740fc [Serializer] ObjectNormalizer: context can contain not serializable data
nicolas-grekas
pushed a commit
that referenced
this pull request
Jan 23, 2017
…er in autowired classes (brainexe) This PR was squashed before being merged into the 3.1 branch (closes symfony#21372). Discussion ---------- [DependencyInjection] Fixed variadic method parameter in autowired classes | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | -- | License | MIT Autowiring classes containing methods with variadic method parameter throws a ReflectionException in compile process: ``` PHP Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php:437 Stack trace: #0 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(437): ReflectionParameter->getDefaultValue() #1 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(80): Symfony\Component\DependencyInjection\Compiler\AutowirePass::getResourceMetadataForMethod(Object(ReflectionMethod)) #2 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(105): Symfony\Component\DependencyInjection\Compiler\AutowirePass::createResourceForClass(Object(ReflectionClass)) #3 /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php(48): Symfony\Component\DependencyInjection\Compiler\AutowirePass->completeDefinition('__controller.Sw...', Object(Symfony\Component\DependencyInjection\Definition), Array) #4 /.../vendor/symfony/dependency-injection/Compiler/Compiler in /.../vendor/symfony/dependency-injection/Compiler/AutowirePass.php on line 437 ``` **Example:** ``` <?php class FooVariadic { public function bar(...$arguments) { } } $method = new ReflectionMethod(FooVariadic::class, 'bar'); $parameter = $method->getParameters()[0]; $parameter->getDefaultValue(); // -> ReflectionException: Internal error: Failed to retrieve the default value in ... ``` Commits ------- a7f63de [DependencyInjection] Fixed variadic method parameter in autowired classes
nicolas-grekas
pushed a commit
that referenced
this pull request
Mar 12, 2018
…Handler (hjanuschka) This PR was submitted for the master branch but it was squashed and merged into the 4.0 branch instead (closes symfony#26403). Discussion ---------- fix the handling of timestamp in the MongoDBSessionHandler | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT in the process of upgrading from 3.4 to 4.0 we stumbled upon a issue with mongo session handler. ``` [05-Mar-2018 11:12:57 Europe/Vienna] PHP Fatal error: Uncaught Error: Call to undefined method Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler::createDateTime() in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php:144 Stack trace: #0 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler->updateTimestamp('96d983b59f8aef8...', 'user_obj|O:9:"k...') #1 [internal function]: session_write_close() #2 {main} thrown in /opt/APP/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php on line 144 ``` this PR re-add's the method, that somehow got removed in 4.0 branch, whereas the interface forces to have the implemantation. Commits ------- 97d9ea8 fix the handling of timestamp in the MongoDBSessionHandler
nicolas-grekas
pushed a commit
that referenced
this pull request
Mar 19, 2018
…stamp in the MemcachedSessionHandler (Alessandro Loffredo) This PR was merged into the 3.4 branch. Discussion ---------- [Fix][3.4][HttpFoundation] Fix the updating of timestamp in the MemcachedSessionHandler | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT Conditions: Symfony 3.4, PHP7 and sessions handled over memcache. Apparently `memcached::touch()` returns `false` on a subsequent call with the same parameters. Since `updateTimestamp` is used in `AbstractSessionHandler::write()` ``` public function write($sessionId, $data) { if (\PHP_VERSION_ID < 70000 && $this->prefetchData) { $readData = $this->prefetchData; $this->prefetchData = null; if ($readData === $data) { return $this->updateTimestamp($sessionId, $data); } } ... ``` the result is that `write()` will return `false` on **any subsequent request within the same second** causing the following error: ``` HP Fatal error: Uncaught Symfony\Component\Debug\Exception\ContextErrorException: Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions) in Unknown:0 Stack trace: #0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(2, 'session_write_c...', 'Unknown', 0, NULL) #1 [internal function]: session_write_close() #2 {main} thrown in Unknown on line 0 ``` Can be reproduced on `symfony/skeleton:3.4` adding the following code to `public/index.php` and performing two consecutive requests: ``` $session = $kernel->getContainer()->get('session'); $session->set("foo", "bar"); ``` Commits ------- d007469 fix the updating of timestamp in the MemcachedSessionHandler
nicolas-grekas
pushed a commit
that referenced
this pull request
Sep 4, 2018
This PR was merged into the 4.2-dev branch. Discussion ---------- Mark ExceptionInterfaces throwable #2 | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This has been reverted in beta of 4.1 because of lack of support in prophecy, which has been fixed since then (incl. release). Can be merged again. References: symfony#26702 symfony#27420 symfony#27419 phpspec/prophecy#412 ping @dunglas @ciaranmcnulty @dkarlovi @Wirone @teohhanhui @stof @nicolas-grekas @ondrejmirtes Commits ------- 17c3675 Mark ExceptionInterfaces throwable
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 8, 2018
This PR was merged into the 3.4 branch. Discussion ---------- Correct PHPDoc type for float ttl | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A It can be null as the Lock instance accepts it. It will fix that kind of PHPStan issue: ``` src/AppBundle/Command/AbstractCommand.php:45:Parameter #2 $ttl of method Symfony\Component\Lock\Factory::createLock() expects float, null given. ``` Commits ------- b662e7e Correct PHPDoc type for float ttl
nicolas-grekas
added a commit
that referenced
this pull request
Nov 15, 2018
…s not exist (neeckeloo) This PR was merged into the 4.2-dev branch. Discussion ---------- [Messenger] Improved message when handler class does not exist | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? |no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | **Problem:** When defining a non existing messenger handler class in the `services.yml` config file, we encounter this confusing error message: ``` services: App\Handler\NonExistentHandler: tags: [messenger.message_handler] ``` ``` PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Argument 1 passed to Symfony\Component\Messenger\DependencyInjection\MessengerPass::guessHandledClasses() must be an instance of ReflectionClass, null given, called in /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php on line 93 in /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php:189 Stack trace: #0 /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php(93): Symfony\Component\Messenger\DependencyInjection\MessengerPass->guessHandledClasses(NULL, 'App\\Application...') #1 /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php(74): Symfony\Component\Messenger\DependencyInjection\MessengerPass->registerHandlers(Object(Symfony\Component\DependencyInjection\ContainerBuilder), Array) #2 /app/vendor/symfony/dependency-injection/Compiler/Compiler.php(95): Symfony\Component\Messenger\DependencyInjection\MessengerPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder)) #3 / in /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php on line 189 ``` **Proposal:** We can throw a more relevant exception (RuntimeException) in this case to help the developer to have a better understanding of the issue. ```Invalid service "App\Handler\NonExistentHandler": class "App\Handler\NonExistentHandler" does not exist.``` Commits ------- 6ab9274 Improve error message when defining messenger handler class that does not exists
nicolas-grekas
pushed a commit
that referenced
this pull request
Mar 25, 2019
…logs (fabpot) This PR was merged into the 4.3-dev branch. Discussion ---------- [Messenger] Add missing information in messenger logs | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes-ish | New feature? | yes-ish | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a When using `messenger:consume`, I get the following logs: ``` 2019-03-25T11:39:05+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:05+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:05+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #1. 2019-03-25T11:39:05+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport" 2019-03-25T11:39:06+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:06+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:06+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #2. 2019-03-25T11:39:06+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport" 2019-03-25T11:39:09+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:09+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage" 2019-03-25T11:39:09+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #3. 2019-03-25T11:39:09+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport" ``` So, an. error occurred, but I have no idea what's going on. The exception is in the context, but the context is not displayed by default. So, this PR fixes it. Commits ------- 20664ca [Messenger] added missing information in messenger logs
nicolas-grekas
added a commit
that referenced
this pull request
Apr 18, 2019
… is empty (yceruto) This PR was merged into the 4.2 branch. Discussion ---------- [HttpKernel] Fix get session when the request stack is empty | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT This bug happen behind an exception on a kernel response event, when one collector (e.g. `RequestDataCollector`) is trying to get the request session and the request stack is currently empty. **Reproducer** https://github.com/yceruto/get-session-bug (`GET /`) See logs on terminal: ```bash Apr 15 20:29:03 |ERROR| PHP 2019-04-15T20:29:03-04:00 Call to a member function isSecure() on null Apr 15 20:29:03 |ERROR| PHP PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function isSecure() on null in /home/yceruto/demos/getsession/vendor/symfony/http-kernel/EventListener/SessionListener.php:43 Apr 15 20:29:03 |DEBUG| PHP Stack trace: Apr 15 20:29:03 |DEBUG| PHP #0 /home/yceruto/demos/getsession/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php(59): Symfony\Component\HttpKernel\EventListener\SessionListener->getSession() Apr 15 20:29:03 |DEBUG| PHP #1 /home/yceruto/demos/getsession/vendor/symfony/http-foundation/Request.php(707): Symfony\Component\HttpKernel\EventListener\AbstractSessionListener->Symfony\Component\HttpKernel\EventListener\{closure}() Apr 15 20:29:03 |DEBUG| PHP #2 /home/yceruto/demos/getsession/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php(65): Symfony\Component\HttpFoundation\Request->getSession() Apr 15 20:29:03 |DEBUG| PHP #3 /home/yceruto/demos/getsession/vendor/symfony/http-kernel/Profiler/Profiler.php(167): Symfony\Component\HttpKernel\DataCollector\RequestDataCollector->collect(Object(Symfony\Component\HttpFoundation\Request), Object(Symfony\Component\HttpFoundation\Respo in /home/yceruto/demos/getsession/vendor/symfony/http-kernel/EventListener/SessionListener.php on line 43 ``` Friendly ping @nicolas-grekas as author of the previous PR symfony#28244 Commits ------- d62ca37 Fix get session when the request stack is empty
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 2, 2019
…dmaicher) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] conflict with VarDumper < 4.4 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - While trying FrameworkBundle 4.4.x-dev I noticed that I was still using VarDumper 4.3 which leads to this error: ``` > app/console cache:clear Fatal error: Uncaught Symfony\Component\ErrorHandler\Exception\ClassNotFoundException: Attempted to load class "ContextualizedDumper" from namespace "Symfony\Component\VarDumper\Dumper". Did you forget a "use" statement for another namespace? in /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/getDebug_DumpListenerService.php:13 Stack trace: #0 /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/appAppKernelDevDebugContainer.php(1357): require() #1 /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/appAppKernelDevDebugContainer.php(2282): ContainerB7mbdCh\appAppKernelDevDebugContainer->load('getDebug_DumpLi...') #2 /var/www/x/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php(275): ContainerB7mbdCh\appAppKernelDevDebugContainer->ContainerB7mbdCh\{closure}() #3 /var/www/x/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php(90): Symfony\Component\EventDispatcher\EventDispatcher->sortListeners('console.command') #4 /var/www/x in /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/getDebug_DumpListenerService.php on line 13 PHP Fatal error: Uncaught Symfony\Component\ErrorHandler\Exception\ClassNotFoundException: Attempted to load class "ContextualizedDumper" from namespace "Symfony\Component\VarDumper\Dumper". Did you forget a "use" statement for another namespace? in /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/getDebug_DumpListenerService.php:13 Stack trace: #0 /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/appAppKernelDevDebugContainer.php(1357): require() #1 /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/appAppKernelDevDebugContainer.php(2282): ContainerB7mbdCh\appAppKernelDevDebugContainer->load('getDebug_DumpLi...') #2 /var/www/x/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php(275): ContainerB7mbdCh\appAppKernelDevDebugContainer->ContainerB7mbdCh\{closure}() #3 /var/www/x/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php(90): Symfony\Component\EventDispatcher\EventDispatcher->sortListeners('console.command') #4 /var/www/x in /var/www/x/symfony/app/cache/dev/ContainerB7mbdCh/getDebug_DumpListenerService.php on line 13 Script app/console cache:clear handling the post-update-cmd event returned with error code 255 ``` So we need to use `symfony/var-dumper >= 4.4` Commits ------- 9b512c6 [FrameworkBundle] conflict with VarDumper < 4.4
nicolas-grekas
pushed a commit
that referenced
this pull request
Nov 18, 2019
This PR was squashed before being merged into the 3.4 branch (closes symfony#34422). Discussion ---------- Update HttpKernel.php phpstan-symfony (0.11.6) level 5 Parameter #2 $values of method Symfony\Component\HttpFoundation\HeaderBag::set() expects array|string, int given. | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | Commits ------- 7b7f966 Update HttpKernel.php
nicolas-grekas
pushed a commit
that referenced
this pull request
Jun 27, 2020
…tack() (dunglas) This PR was merged into the 5.1 branch. Discussion ---------- [DI] Fix call to sprintf in ServicesConfigurator::stack() | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a This PR fixes a faulty call to `sprintf()` and prevents the following error: ``` Warning: sprintf(): Too few arguments in /Users/dunglas/workspace/activity-pub/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php on line 154 Fatal error: Uncaught Error: Wrong parameters for Symfony\Component\DependencyInjection\Exception\InvalidArgumentException([string $message [, long $code [, Throwable $previous = NULL]]]) in /Users/dunglas/workspace/activity-pub/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php:154 Stack trace: #0 /Users/dunglas/workspace/activity-pub/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php(154): Exception->__construct('', 1, 'api_platform.js...') #1 /Users/dunglas/workspace/activity-pub/src/Bundle/Resources/config/services.php(12): Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator->stack('api_platform.js...', Array) #2 /Users/dunglas/workspace/activity-pub/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php(50): Symfony\Component\DependencyInjection\Loader\ProtectedPhpFileLoader::Symfony\Component\DependencyInjection\Loader\Configurator\{closure}(Object(Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurat in /Users/dunglas/workspace/activity-pub/vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php on line 154 ``` Commits ------- 11da9d3 [DI] Fix call to sprintf in ServicesConfigurator::stack()
nicolas-grekas
pushed a commit
that referenced
this pull request
Feb 23, 2021
This PR was merged into the 5.3-dev branch. Discussion ---------- [Security] Added debug:firewall command | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix symfony#39321 | License | MIT | Doc PR | symfony/symfony-docs#14982 | Tags | #SymfonyHackday ### Subtasks - [x] Add list view (for use without arguments) - [x] Add more information to list view - [x] Add detail view (for use with `firewall` argument) - [x] Add more information to detail view table - [x] Add authenticators list - [x] Add event listeners & events (copy from `debug:event-listener`) - [x] Add `--include-listeners` option (default: false) - [x] Add helptext - [x] Add documentation ### Moved outside of current scope - Add allowed badges ### Usage (and example output) for a list `bin/console debug:firewall` ``` Firewalls ========= The following firewalls are defined: -------- Name -------- dev public main -------- // To view details of a specific firewall, re-run this command with a firewall name. (e.g. debug:firewall // main) ``` ### Usage (and example output) for details `bin/console debug:firewall main` ``` Firewall "main" =============== ----------------------- --------------------------------------------------- Option Value ----------------------- --------------------------------------------------- Name main Context main Lazy Yes Stateless No User Checker security.user_checker Provider security.user.provider.concrete.app_user_provider Entry Point App\Security\LoginFormAuthenticator Access Denied URL Access Denied Handler ----------------------- --------------------------------------------------- User switching -------------- ----------- --------------------------------------------------- Option Value ----------- --------------------------------------------------- Parameter test Provider security.user.provider.concrete.app_user_provider User Role ROLE_SWITCH_POSSIBLE ----------- --------------------------------------------------- Event listeners for firewall "main" =================================== "Symfony\Component\Security\Http\Event\LoginSuccessEvent" event --------------------------------------------------------------- ------- -------------------------------------------------------------------------------------------- ---------- Order Callable Priority ------- -------------------------------------------------------------------------------------------- ---------- #1 Symfony\Component\Security\Http\EventListener\UserCheckerListener::postCheckCredentials() 256 #2 Symfony\Component\Security\Http\EventListener\SessionStrategyListener::onSuccessfulLogin() 0 #3 Symfony\Component\Security\Http\EventListener\RememberMeListener::onSuccessfulLogin() 0 #4 App\Security\UpdateLastLogin::__invoke() 0 #5 Symfony\Component\Security\Http\EventListener\PasswordMigratingListener::onLoginSuccess() 0 ------- -------------------------------------------------------------------------------------------- ---------- "Symfony\Component\Security\Http\Event\LogoutEvent" event --------------------------------------------------------- ------- ------------------------------------------------------------------------------------------- ---------- Order Callable Priority ------- ------------------------------------------------------------------------------------------- ---------- #1 Symfony\Component\Security\Http\EventListener\DefaultLogoutListener::onLogout() 64 #2 Symfony\Component\Security\Http\EventListener\SessionLogoutListener::onLogout() 0 #3 Symfony\Component\Security\Http\EventListener\RememberMeLogoutListener::onLogout() 0 #4 Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener::onLogout() 0 ------- ------------------------------------------------------------------------------------------- ---------- "Symfony\Component\Security\Http\Event\CheckPassportEvent" event ---------------------------------------------------------------- ------- ------------------------------------------------------------------------------------------ ---------- Order Callable Priority ------- ------------------------------------------------------------------------------------------ ---------- #1 Symfony\Component\Security\Http\EventListener\LoginThrottlingListener::checkPassport() 2080 #2 Symfony\Component\Security\Http\EventListener\UserProviderListener::checkPassport() 2048 #3 Symfony\Component\Security\Http\EventListener\UserProviderListener::checkPassport() 1024 #4 Symfony\Component\Security\Http\EventListener\CsrfProtectionListener::checkPassport() 512 #5 Symfony\Component\Security\Http\EventListener\UserCheckerListener::preCheckCredentials() 256 #6 App\Security\DisallowBannedUsers::__invoke() 0 #7 Symfony\Component\Security\Http\EventListener\CheckCredentialsListener::checkPassport() 0 ------- ------------------------------------------------------------------------------------------ ---------- "Symfony\Component\Security\Http\Event\LoginFailureEvent" event --------------------------------------------------------------- ------- ----------------------------------------------------------------------------------- ---------- Order Callable Priority ------- ----------------------------------------------------------------------------------- ---------- #1 Symfony\Component\Security\Http\EventListener\RememberMeListener::onFailedLogin() 0 ------- ----------------------------------------------------------------------------------- ---------- Authenticators for firewall "main" ================================== // @todo: List authenticator information ``` Commits ------- a9dea1d [Security] Added debug:firewall command
nicolas-grekas
pushed a commit
that referenced
this pull request
Apr 17, 2021
…e (Plopix) This PR was merged into the 4.4 branch. Discussion ---------- RequestMatcher issue when `_controller` is a closure | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT ## Description If the `matches` method of `RequestMatcher` is used on an attribute which is a closure it crashes. ## How did we get it On a project that is using FOS HTTP Cache, we have this configuration ```yaml fos_http_cache: cache_control: rules: - match: attributes: { _controller: ^App\\Controller\\.*::.* } headers: overwrite: true cache_control: { public: true, private: false, must_revalidate: true, s_maxage: 3600 } ``` Everything works fine unless you are reaching a controller that is a closure. You get a ```TypeError: preg_match(): Argument #2 ($subject) must be of type string, Closure given``` which is to me logical. ## Proposed solution Just testing the type of attribute value and return false before crashing `preg_match` This PR adds a quick unit test to enforce this. Commits ------- 6649123 Fix issue with RequestMatcher when attribute is a closure
nicolas-grekas
pushed a commit
that referenced
this pull request
May 1, 2021
…h case insensitive (javiereguiluz) This PR was merged into the 5.3-dev branch. Discussion ---------- [FrameworkBundle] Make debug:event-dispatcher search case insensitive | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - I was playing with the new features of `debug:event-dispatcher` and I thought that making the new search feature case insensitive could be better: ### Before ``` $ php bin/console debug:event-dispatcher mailer [WARNING] The event "mailer" does not have any registered listeners. ``` ### After ``` $ php bin/console debug:event-dispatcher mailer Registered Listeners of Event Dispatcher "debug.event_dispatcher" for "Symfony\Component\Mailer\Event\MessageEvent" Event ========================================================================================================================= ------- --------------------------------------------------------------------------- ---------- Order Callable Priority ------- --------------------------------------------------------------------------- ---------- #1 Symfony\Component\Mailer\EventListener\MessageListener::onMessage() 0 #2 Symfony\Component\Mailer\EventListener\EnvelopeListener::onMessage() -255 #3 Symfony\Component\Mailer\EventListener\MessageLoggerListener::onMessage() -255 ------- --------------------------------------------------------------------------- ---------- ``` Commits ------- 1e4c7d9 [FrameworkBundle] Make debug:event-dispatcher search case insensitive
nicolas-grekas
pushed a commit
that referenced
this pull request
Dec 19, 2021
DOMElement::setAttribute(): Passing null to parameter #2 ($value) of type string is deprecated This happens when a tag value is `null` on PHP 8.1.
nicolas-grekas
pushed a commit
that referenced
this pull request
Dec 19, 2021
…tring (ruudk) This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] Cast tag attribute value to string | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? |no | Deprecations? |no | Tickets | | License | MIT | Doc PR | ``` DOMElement::setAttribute(): Passing null to parameter #2 ($value) of type string is deprecated ``` This happens when a tag value is `null` on PHP 8.1. Commits ------- 8fe5fce [DependencyInjection] Cast tag value to string
nicolas-grekas
pushed a commit
that referenced
this pull request
Jan 13, 2022
…tations (sormes) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Validator] Error using CssColor with doctrine annotations | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | none | License | MIT When use doctrine annotations and set formats parameter throw and error `array_merge(): Argument #2 must be of type array, null given` `in vendor/symfony/validator/Constraints/CssColor.php (line 75) ` Commits ------- bba6e15 [Validator] Error using CssColor with doctrine annotations
nicolas-grekas
added a commit
that referenced
this pull request
Jan 24, 2022
… resource (Seldaek) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Process] Avoid calling fclose on an already closed resource | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> I got this in Composer while interrupting an install process with Ctrl-C. ``` PHP Fatal error: Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php:50 Stack trace: #0 /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php(50): fclose() #1 /var/www/composer/vendor/symfony/process/Pipes/UnixPipes.php(50): Symfony\Component\Process\Pipes\AbstractPipes->close() #2 [internal function]: Symfony\Component\Process\Pipes\UnixPipes->__destruct() #3 {main} thrown in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php on line 50 ``` I am assuming it's due to a process which was not closed properly, which is very likely given we run a bunch of them concurrently.. It's pretty hard to debug as it's also hard to reproduce, so I am not sure what to do except handle this case gracefully in the close/__destruct function and hope that at least lets it clean up processes without crashing this way. Commits ------- a9e43a7 [Process] Avoid calling fclose on an already closed resource
nicolas-grekas
added a commit
that referenced
this pull request
Feb 28, 2022
…usse) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] Handle requests with null body | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | / | License | MIT | Doc PR | / since symfony#45527 passing null to the `body` parameters leads to an exception (which [breaks async-aws](https://github.com/async-aws/aws/blob/09723ddca29b8d1d522426f81dd422373de1785f/src/Core/src/AbstractApi.php#L157)) > Argument #2 ($body) must be of type Closure, null given, called in /home/runner/work/aws/aws/vendor/symfony/http-client/CurlHttpClient.php on line 221 In curl client: `null` is not a string and `self::readRequestBody` expects a closure. https://github.com/symfony/symfony/blob/08fa74a16c84895575e305b2a7ee3a03e371f79b/src/Symfony/Component/HttpClient/CurlHttpClient.php#L214-L221 In NativeClient, `getBodyAsString` will fail to return `null` because of the `string` return type. Before symfony#45527 null was converted to `""` thanks to the defaultOptions, but this is not the case anymore. In many places, we check if the body is `!== ""` but rarely check if the body is null, this PR restores the original behaviors for the `body` parameters and converts nulls to `""`. Commits ------- 39aec09 [HttpClient] Handle requests with null body
nicolas-grekas
pushed a commit
that referenced
this pull request
Apr 13, 2022
Because Security::LAST_USERNAME not always exist, it can trigger a "preg_match(): Argument #2 ($subject) must be of type string" if $username is null
nicolas-grekas
pushed a commit
that referenced
this pull request
Apr 13, 2022
…Security::LAST_USERNAME (David-Crty) This PR was merged into the 5.4 branch. Discussion ---------- [RateLimiter] Adding default empty string value on Security::LAST_USERNAME Because `Security::LAST_USERNAME` not always exist, it can trigger a `preg_match(): Argument #2 ($subject) must be of type string` if $username is null The error is critical when having `declare(strict_types=1)`, to avoid issue when people create their own LoginRateLimiter from the DefaultLoginRateLimiter we can juste set a default empty string. | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT Commits ------- 0fdfcae [RateLimiter] Adding default empty value
nicolas-grekas
pushed a commit
that referenced
this pull request
Jun 19, 2022
In the cached file of my application I can see the following code fragment that have been generated by Symfony: ```php if (( !((array_key_exists("render_preferred_choices", $context)) ? (_twig_default_filter((isset($context["render_preferred_choices"]) || array_key_exists("render_preferred_choices", $context) ? $context["render_preferred_choices"] : (function () { throw new RuntimeError('Variable "render_preferred_choices" does not exist.', 88, $this->source); })()), false)) : (false)) && Symfony\Bridge\Twig\Extension\twig_is_selected_choice($context["choice"], (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new RuntimeError('Variable "value" does not exist.', 88, $this->source); })())))) { echo " selected=\"selected\""; } ``` The 2nd Arg passed when calling ``twig_is_selected_choice`` if the result of ``(isset($context["value"]) || array_key_exists("value", $context) ? $context["value"]``. In that condition, if ``$context['value'] = null, we pass the null Currently I got the following error: ``` Symfony\Bridge\Twig\Extension\twig_is_selected_choice(): Argument #2 ($selectedValue) must be of type array|string, null given, called in X:\workspace-novento\novento-vip-lounge\var\cache\admin_dev\twig\01\01615438ee40292438687b29025d08a9.php on line 534 ```
nicolas-grekas
pushed a commit
that referenced
this pull request
Jun 19, 2022
…el057) This PR was merged into the 6.0 branch. Discussion ---------- Allow passing null in twig_is_selected_choice | Q | A | ------------- | --- | Branch? | 6.0 and > | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT In the cached file of my application, generated by Symfony I can see the following code fragment: ```php if (( !((array_key_exists("render_preferred_choices", $context)) ? (_twig_default_filter((isset($context["render_preferred_choices"]) || array_key_exists("render_preferred_choices", $context) ? $context["render_preferred_choices"] : (function () { throw new RuntimeError('Variable "render_preferred_choices" does not exist.', 88, $this->source); })()), false)) : (false)) && Symfony\Bridge \Twig\Extension\twig_is_selected_choice($context["choice"], (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new RuntimeError('Variable "value" does not exist.', 88, $this->source); })())))) { echo " selected=\"selected\""; } ``` The 2nd Arg passed when calling ``twig_is_selected_choice`` is the result of ``(isset($context["value"]) || array_key_exists("value", $context) ? $context["value"]``. So in case ``$context['value'] = null``, we pass ``null`` as 2nd arg of ``twig_is_selected_choice``. As a result in some case, when I submit form with empty (null) value, I got the following error: ``` Symfony\Bridge\Twig\Extension\twig_is_selected_choice(): Argument #2 ($selectedValue) must be of type array|string, null given, called in ...\var\cache\dev\twig\01\01615438ee40292438687b29025d08a9.php on line 534 ``` Commits ------- 0186ecb Allow passing null in twig_is_selected_choice
nicolas-grekas
pushed a commit
that referenced
this pull request
Jul 27, 2022
…es (SerafimArts) This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [VarDumper] Add `FFI\CData` and `FFI\CType` types | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Added support of FFI: ```php $ffi = \FFI::cdef(<<<'CPP' typedef struct { int x; int y; } Point; typedef struct Example { uint8_t array[32]; long longVal; __extension__ union { __extension__ struct { short shortVal; }; struct { Point point; float e; }; }; bool boolValue; int (*func)(struct __sub *h); } Example; CPP); $struct = $ffi->new('Example'); $struct->func = (static fn (object $ptr) => 42); dump($struct); ``` **Before** ``` FFI\CData {#2} ``` **After** ``` FFI\CData<struct Example> size 64 align 8 {#2 +array: FFI\CData<uint8_t[32]> size 32 align 1 {#18} +int32_t longVal: 0 +int16_t shortVal: 0 +point: FFI\CData<struct <anonymous>> size 8 align 4 {#17 +int32_t x: 0 +int32_t y: 0 } +float e: 0.0 +bool boolValue: false +func: [cdecl] callable(struct __sub*): int32_t {#20 returnType: FFI\CType<int32_t> size 4 align 4 {#25} } } ``` P.S. I apologize for the multiple force pushes, errors in tests and codestyle have been fixed. ## Review And TODOs - Pointers - [x] Pointer to scalar tests. - [x] Pointer to struct tests. - [x] "Special" pointer to `char*` tests (with `\0` and without `\0`). - Possible Errors - [x] Do not dump union fields with pointer references (possible SIGSEGV). Commits ------- 1c7dc52 [VarDumper] Add `FFI\CData` and `FFI\CType` types
nicolas-grekas
added a commit
that referenced
this pull request
Dec 14, 2022
…(HypeMC) This PR was merged into the 6.2 branch. Discussion ---------- [HttpKernel] Fix `CacheAttributeListener` priority | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Currently the `CacheAttributeListener` & the `IsGrantedAttributeListener` have the same priority: ``` Registered Listeners for "kernel.controller_arguments" Event ============================================================ ------- --------------------------------------------------------------------------------------------------------- ---------- Order Callable Priority ------- --------------------------------------------------------------------------------------------------------- ---------- #1 Symfony\Component\HttpKernel\EventListener\CacheAttributeListener::onKernelControllerArguments() 10 #2 Symfony\Component\Security\Http\EventListener\IsGrantedAttributeListener::onKernelControllerArguments() 10 #3 Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments() 0 ------- --------------------------------------------------------------------------------------------------------- ---------- ``` Since the `CacheAttributeListener` is alphabetically first, it's first to get triggered. This can cause an unauthenticated user to receive a 304 Not modified instead of a 302 Redirect, resulting in the user seeing some stale content from when they were authenticated instead of getting redirected to the login page. This PR changes the priority of the `CacheAttributeListener` to be lower than that of the `IsGrantedAttributeListener`. Commits ------- 90eb89f [HttpKernel] Fix CacheAttributeListener priority
nicolas-grekas
added a commit
that referenced
this pull request
Feb 6, 2023
…azak) This PR was submitted for the 6.2 branch but it was merged into the 5.4 branch instead. Discussion ---------- [Serializer] Fix CsvEncoder decode on empty data | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Test that reproduces the error: https://gist.github.com/cazak/954d8bfe53d5b9139667eae8fe53957f The message i get after running the test: 1x: explode(): Passing null to parameter #2 ($string) of type string is deprecated 1x in CsvEncoderTest::testSuccess from App\Tests\Functional\Task Commits ------- 6c22622 [Serializer] Fix CsvEncoder decode on empty data
nicolas-grekas
added a commit
that referenced
this pull request
Feb 24, 2023
…rows PHP 8.1 deprecation when no user agent is set (juagarc4) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes/no | New feature? no | Deprecations? no | Tickets | Fix symfony#49392 | License | MIT - Add casting to the second parameter to pass always the right type. **PHPstan before:** ------ -------------------------------------------------------------------------------------------------------- Line FirePHPHandler.php ------ -------------------------------------------------------------------------------------------------------- 27 Property Symfony\Bridge\Monolog\Handler\FirePHPHandler::$headers has no type specified. 37 Method Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse() has no return type specified. **44 Parameter #2 $subject of function preg_match expects string, string|null given.** 68 If condition is always true. ------ -------------------------------------------------------------------------------------------------------- **PHPstan after:** ------ -------------------------------------------------------------------------------------------------------- Line FirePHPHandler.php ------ -------------------------------------------------------------------------------------------------------- 27 Property Symfony\Bridge\Monolog\Handler\FirePHPHandler::$headers has no type specified. 37 Method Symfony\Bridge\Monolog\Handler\FirePHPHandler::onKernelResponse() has no return type specified. 68 If condition is always true. ------ -------------------------------------------------------------------------------------------------------- Commits ------- 4d84c46 [MonologBridge] FirePHPHandler::onKernelResponse throws PHP 8.1 deprecation when no user agent is set
nicolas-grekas
added a commit
that referenced
this pull request
Feb 24, 2023
…ult Enum parameter in constructor (kapiwko) This PR was submitted for the 6.3 branch but it was squashed and merged into the 5.4 branch instead. Discussion ---------- [VarDumper] Fix error when reflected class has default Enum parameter in constructor | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | no | License | MIT | Doc PR | no Have classes: ``` enum GeometryType: string { case Geometry = 'GEOMETRY'; } ``` ``` final class Geometry { public function __construct(GeometryType $type = GeometryType::Geometry) { } } ``` Try to dump reflection of class Geometry: ``` $reflection = new \ReflectionClass(Geometry::class); dump($reflection); ``` Have error: `Symfony\Component\VarDumper\Caster\ConstStub::__construct(): Argument #2 ($value) must be of type string|int|float|null, App\Infrastructure\Geometry\GeometryType given, called in [...]/vendor/symfony/var-dumper/Caster/ReflectionCaster.php on line 296` Commits ------- d6a7730 [VarDumper] Fix error when reflected class has default Enum parameter in constructor
nicolas-grekas
added a commit
that referenced
this pull request
Oct 18, 2023
…form field type inside array (l-naumann) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Mime] Throw InvalidArgumentException on invalid form field type inside array | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT Example code: ```php $f = new FormDataPart([ 'foo' => [ 'bar' => 'baz', 'qux' => [ 'quux' => 1, ], ], ]); $f->getParts(); ``` Currently, when you use a disallowed type inside an array, a TypeError is thrown: ` Symfony\Component\Mime\Part\Multipart\FormDataPart::configurePart(): Argument #2 ($part) must be of type Symfony\Component\Mime\Part\TextPart, int given` This change adds a clearly understandable error message: `The value of the form field "foo[qux][quux]" can only be a string, an array, or an instance of TextPart ("int" given).` Commits ------- 08f5d7c [Mime] Throw InvalidArgumentException on invalid form field type inside array
nicolas-grekas
pushed a commit
that referenced
this pull request
Jan 23, 2024
This PR was merged into the 5.4 branch. Discussion ---------- [Process] Fixed inconsistent test | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | N/A | License | MIT Sometimes the process no longer appears to be running when the signal is sent which causes a LogicException to be thrown. This doesn't appear to be consistent and I can reproduce it randomly on my local machine. To avoid having tests fail at random I decided that it's better to send the signal only if the process is still marked as running. ```bash amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds. amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php PHP Fatal error: Uncaught Symfony\Component\Process\Exception\LogicException: Cannot send signal on a non running process. in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php:1502 Stack trace: #0 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php(516): Symfony\Component\Process\Process->doSignal() #1 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php(28): Symfony\Component\Process\Process->signal() #2 {main} thrown in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php on line 1502 ``` Commits ------- 00ee4ca [Process] Fixed inconsistent test
nicolas-grekas
added a commit
that referenced
this pull request
Jan 29, 2024
…read from socket (xdanik) This PR was merged into the 5.4 branch. Discussion ---------- [Mailer] Throw `TransportException` when unable to read from socket | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? |no | Issues | None | License | MIT We are seeing error `fgets(): SSL: Connection reset by peer` multiple times a day from connection to Office 365 SMTP server (smtp.office365.com:587). It's certainly related to some kind of timeout as we are sending emails from long running queue dispatcher and error shows up only occasionally and never with the first message. We are not seeing this issue with any other SMTP server, but we have not tested much past smtp.mandrillapp.com and local MailHog. We have tried adjusting the `$pingThreshold` and `$restartThreshold` options, but without much success (well `$restartThreshold = 1` resolves the issue, but it also forces the transport to close connection after each message). Stack trace: ``` #0 /var/www/vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php(77): fgets(Resource(stream)) #1 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(315): Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream->readLine() #2 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(181): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->getFullResponse() #3 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(140): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->executeCommand("RSET ", Array(1)) #4 /var/www/vendor/symfony/mailer/Mailer.php(45): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send(Object(Symfony\Component\Mime\Email), Null) #5 (our queue dispatcher): Symfony\Component\Mailer\Mailer->send(Object(Symfony\Component\Mime\Email)) ``` App is running on PHP 8.0.28 on Debian Linux x64, Mailer v5.4.22. I would gladly written some tests for this, but I don't know how to simulate calls to low-level stream functions like fgets. Commits ------- 44d5b57 [Mailer] Throw TransportException when unable to read from socket
nicolas-grekas
pushed a commit
that referenced
this pull request
Mar 7, 2024
…hen publishing a message. (jwage) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message. | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#36538 Fix symfony#48241 | License | MIT If you have a message handler that dispatches messages to another queue, you can encounter `AMQPConnectionException` with the message "Library error: a SSL error occurred" or "a socket error occurred" depending on if you are using tls or not or if you are running behind a load balancer or not. You can manually reproduce this issue by dispatching a message where the handler then dispatches another message to a different queue, then go to rabbitmq admin and close the connection manually, then dispatch another message and when the message handler goes to dispatch the other message, you will get this exception: ``` a socket error occurred #0 /vagrant/vendor/symfony/amqp-messenger/Transport/AmqpTransport.php(60): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpSender->send() #1 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(62): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport->send() #2 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle() #3 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(61): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle() #4 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle() #5 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle() #6 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle() #7 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle() #8 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch() #9 /vagrant/src/Messenger/MessageBus.php(37): Symfony\Component\Messenger\TraceableMessageBus->dispatch() #10 /vagrant/vendor/symfony/mailer/Mailer.php(66): App\Messenger\MessageBus->dispatch() #11 /vagrant/src/Mailer/Mailer.php(83): Symfony\Component\Mailer\Mailer->send() #12 /vagrant/src/Mailer/Mailer.php(96): App\Mailer\Mailer->send() #13 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(118): App\Mailer\Mailer->sendEmail() #14 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(72): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->handle() #15 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(152): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->__invoke() #16 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(91): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->callHandler() #17 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->handle() #18 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle() #19 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(68): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle() #20 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle() #21 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle() #22 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle() #23 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle() #24 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch() #25 /vagrant/vendor/symfony/messenger/RoutableMessageBus.php(54): Symfony\Component\Messenger\TraceableMessageBus->dispatch() #26 /vagrant/vendor/symfony/messenger/Worker.php(162): Symfony\Component\Messenger\RoutableMessageBus->dispatch() #27 /vagrant/vendor/symfony/messenger/Worker.php(109): Symfony\Component\Messenger\Worker->handleMessage() #28 /vagrant/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php(238): Symfony\Component\Messenger\Worker->run() #29 /vagrant/vendor/symfony/console/Command/Command.php(326): Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute() #30 /vagrant/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run() #31 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand() #32 /vagrant/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() #33 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun() #34 /vagrant/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun() #35 /vagrant/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run() #36 /vagrant/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() #37 /vagrant/bin/console(11): require_once('...') #38 {main} ``` TODO: - [x] Add test for retry logic when publishing messages Commits ------- f123370 [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.
nicolas-grekas
pushed a commit
that referenced
this pull request
Mar 15, 2024
…cing keys (Brajk19) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Validator] UniqueValidator - normalize before reducing keys | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT In symfony#42403 checking for uniqueness of certain collection keys was enabled. Method `UniqueValidator::reduceElementKeys` removes all keys which are not specified. Problem is that this happens before normalization, which in my opinion is not great because that method accepts array argument and if i have some object (DTO), TypeError will be thrown. Example: ```php class ParentDTO { /** * `@var` ChildDTO[] */ #[Assert\Unique( normalizer: [ChildDTO::class, 'normalize'] fields: 'id' )] public array $children; } ``` ```php class ChildDTO { public string $id; public string $name; public static function normalize(self $obj): array { return [ 'id' => $obj->id, 'name' => $obj->name ]; } } ``` Because normalization will happen after `reduceElementKeys` this will be thrown: `TypeError: Symfony\Component\Validator\Constraints\UniqueValidator::reduceElementKeys(): Argument #2 ($element) must be of type array, ...\ChildDTO given, called in .../UniqueValidator.php on line 48` If `$element = $normalizer($element);` is executed before `reduceElementKeys` it would enable using Assert\Unique with array of objects when correctly normalized Commits ------- 77df90b [Validator] UniqueValidator - normalize before reducing keys
nicolas-grekas
added a commit
that referenced
this pull request
Apr 16, 2024
…s string similar to username/password (glaubinix) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Security] Validate that CSRF token in form login is string similar to username/password | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | See exception output below | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Fixes ``` Uncaught Error: Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge::__construct(): Argument #2 ($csrfToken) must be of type ?string, array given, called in /vendor/symfony/security-http/Authenticator/FormLoginAuthenticator.php on line 88 ``` Commits ------- b501bba [Security] Validate that CSRF token in form login is string similar to username/password
nicolas-grekas
pushed a commit
that referenced
this pull request
May 13, 2024
…alexandre-daubois) This PR was merged into the 5.4 branch. Discussion ---------- [HttpClient] Fix cURL default options for PHP 8.4 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT PHP 8.4 brings a change in ext/curl (php/php-src#13291) that requires `CurlResponse` to be updated. Curl callbacks cannot be set to null anymore and requires real callable. Here is (one of) the CI error it fixes: ``` 10) Symfony\Component\HttpClient\Tests\CurlHttpClientTest::testGzipBroken Failed asserting that exception of type "TypeError" matches expected exception "Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface". Message was: "curl_setopt_array(): Argument #2 ($options) must be a valid callback for option CURLOPT_PROGRESSFUNCTION, no array or string given" at /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Response/CurlResponse.php:175 /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Internal/Canary.php:32 /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php:90 /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Response/TransportResponseTrait.php:218 /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Response/CommonResponseTrait.php:68 /home/runner/work/symfony/symfony/src/Symfony/Component/HttpClient/Response/CurlResponse.php:232 /home/runner/work/symfony/symfony/src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php:1113 ``` Commits ------- cc0b957 [HttpClient] Fix cURL default options
nicolas-grekas
pushed a commit
that referenced
this pull request
Aug 12, 2024
…rsimpsons) This PR was merged into the 5.4 branch. Discussion ---------- [Yaml] 🐛 throw ParseException on invalid date | Q | A | ------------- | --- | Branch? | 5.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | None <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT (found in symfony-tools/docs-builder#179) When parsing the following yaml: ``` date: 6418-75-51 ``` `symfony/yaml` will throw an exception: ``` $ php main.php PHP Fatal error: Uncaught Exception: Failed to parse time string (6418-75-51) at position 6 (5): Unexpected character in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php:714 Stack trace: #0 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(714): DateTimeImmutable->__construct() #1 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(312): Symfony\Component\Yaml\Inline::evaluateScalar() #2 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(80): Symfony\Component\Yaml\Inline::parseScalar() #3 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(790): Symfony\Component\Yaml\Inline::parse() #4 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(341): Symfony\Component\Yaml\Parser->parseValue() #5 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(86): Symfony\Component\Yaml\Parser->doParse() #6 /tmp/symfony-yaml/vendor/symfony/yaml/Yaml.php(77): Symfony\Component\Yaml\Parser->parse() #7 /tmp/symfony-yaml/main.php(8): Symfony\Component\Yaml\Yaml::parse() #8 {main} thrown in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php on line 714 ``` This is because the "month" is invalid. Fixing the "month" will trigger about the same issue because the "day" would be invalid. With the current change it will throw a `ParseException`. Commits ------- 6d71a7e 🐛 throw ParseException on invalid date
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 22, 2024
* 5.4: do not mix named and positional arguments in data provider definitions session names must not be empty fix Contracts directory name in PHPUnit configuration Passing null to parameter #2 ($subject) of type string is deprecated
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 22, 2024
* 6.4: do not mix named and positional arguments in data provider definitions session names must not be empty fix Contracts directory name in PHPUnit configuration Passing null to parameter #2 ($subject) of type string is deprecated
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 24, 2024
nicolas-grekas
added a commit
that referenced
this pull request
Oct 24, 2024
…h()` (simoheinonen) This PR was merged into the 5.4 branch. Discussion ---------- [MonologBridge] Fix PHP deprecation with `preg_match()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT ``` preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated ``` Commits ------- 4d7a6f6 Passing null to parameter #2 ($subject) of type string is deprecated
nicolas-grekas
pushed a commit
that referenced
this pull request
Oct 24, 2024
* 7.1: do not mix named and positional arguments in data provider definitions session names must not be empty add missing properties fix Contracts directory name in PHPUnit configuration [Validator][CidrValidator] Fix error message for `OutOfRangeNetmask` validation Passing null to parameter #2 ($subject) of type string is deprecated
nicolas-grekas
added a commit
that referenced
this pull request
Nov 20, 2024
… not throw exception (lyrixx) This PR was merged into the 5.4 branch. Discussion ---------- [HttpKernel] Ensure `HttpCache::getTraceKey()` does not throw exception | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT We have such logs in our logs. It's in our raw PHP logs. They are not caught by monolog, it's too early ``` [11-Oct-2024 01:23:33 UTC] PHP Fatal error: Uncaught Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Invalid method override "__CONSTRUCT". in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php:1234 Stack trace: #0 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(728): Symfony\Component\HttpFoundation\Request->getMethod() #1 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(207): Symfony\Component\HttpKernel\HttpCache\HttpCache->getTraceKey() #2 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/Kernel.php(188): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle() #3 /var/www/redirection.io/backend/blue/web/app.php(9): Symfony\Component\HttpKernel\Kernel->handle() #4 {main} thrown in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php on line 1234 ``` I managed to reproduced locally. * Before the patch, without the http_cache, symfony returns a 405 * After the patch, without the http_cache, symfony returns a 405 * Before the patch, with the http_cache, symfony returns a 500, without any information (too early) * After the patch, with the http_cache, symfony returns a 405 Commits ------- a2ebbe0 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.