Skip to content
Permalink
6.2
Switch branches/tags

Commits on Sep 4, 2022

  1. minor #47477 [Clock] sleep in test, 1millisecond to ensure time has c…

    …hanged on fast computers (PhilETaylor)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Clock] sleep in test, 1millisecond to ensure time has changed on fast computers
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | License       | MIT
    
    So... Im "one of those" people that bought a Mac Studio Mac with a Apple M1 Ultra CPU and 128Gb RAM
    
    When running the unit tests for the new Clock Component there is a test that compares before and after with
    
    ```php
    $before = new \DateTimeImmutable();
    $clock = new MockClock();
    $after = new \DateTimeImmutable();
    ```
    
    **50% of the tuns the unit tests fail**, when run on this blazingly fast Mac, fail with message:
    
    <img width="1041" alt="Screen Shot 2022-09-03 at 01 28 01" src="https://user-images.githubusercontent.com/400092/188248812-80ca31f3-3b54-4b5b-a44f-5346f85fa3a8.png">
    
    As you can see the timestamps are exactly the same.
    
    Adding a one millionth of  second delay ensures that on blazingly fast computers (And I DO UNDERSTAND that GitHub action runners/AppVeyor is never going be fast haha) that the tests pass 100% of the time instead of giving false failures.
    
    I appreciate this might be an edge case but computers are only getting faster :) and one day a Mac like this might not cost £6000!
    
    Commits
    -------
    
    4a16953 sleep 1millisecond to ensure time has changed on fast computers
    fabpot committed Sep 4, 2022

Commits on Sep 3, 2022

  1. Merge branch '6.1' into 6.2

    * 6.1:
      tweak the factory class description for inlined factory services
      skip a transient test on Windows
      [Console] [Completion] Make fish completion run in non interactive mode
      Make bash completion run in non interactive mode
    xabbuh committed Sep 3, 2022
  2. Merge branch '6.0' into 6.1

    * 6.0:
      tweak the factory class description for inlined factory services
      skip a transient test on Windows
      Make bash completion run in non interactive mode
    xabbuh committed Sep 3, 2022
  3. Merge branch '5.4' into 6.0

    * 5.4:
      tweak the factory class description for inlined factory services
      skip a transient test on Windows
      Make bash completion run in non interactive mode
    xabbuh committed Sep 3, 2022
  4. Merge branch '4.4' into 5.4

    * 4.4:
      tweak the factory class description for inlined factory services
      skip a transient test on Windows
    xabbuh committed Sep 3, 2022
  5. minor #47465 [VarDumper] skip a transient test on Windows (xabbuh)

    This PR was merged into the 4.4 branch.
    
    Discussion
    ----------
    
    [VarDumper] skip a transient test on Windows
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 4.4
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | #45373 (comment)
    | License       | MIT
    | Doc PR        |
    
    Commits
    -------
    
    fcfcba1 skip a transient test on Windows
    xabbuh committed Sep 3, 2022
  6. feature #47236 [DependencyInjection][VarExporter] Generate lazy-loadi…

    …ng virtual proxies for non-ghostable lazy services (nicolas-grekas)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [DependencyInjection][VarExporter] Generate lazy-loading virtual proxies for non-ghostable lazy services
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | yes
    | Deprecations? | no
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    Since #46752 and #46751, we are able to make services lazy out of the box, except when 1. a service relies on an internal class 2. a service has the `proxy` tag or 3. a service's class is abstract (and the service uses a factory). In these situations, proxy-manager-bridge was required. This was an acceptable trade-off because this would be quite uncommon. But while working on Doctrine, I realized that we cannot use ghost objects when a factory is used. I described this for Doctrine in doctrine/orm#9896 but the situation can happen with any services constructed by a factory. This means we'd need proxy-manager-bridge anytime a factory is used on a lazy service. What was uncommon becomes quite common and the trade-off is not acceptable anymore. Thus this PR.
    
    This PR adds a `LazyProxyTrait` and a `ProxyHelper` to build lazy loading virtual proxies at will. It then wires this new capability into the container. As a result proxy-manager-bridge is not needed anymore. We can deprecate it in another PR.
    
    While the diff is quite big,  `LazyProxyTrait` has many similarities with `LazyGhostTrait` and both traits can be diffed to see where their behavior varies.
    
    Excerpt from the [README](https://github.com/nicolas-grekas/symfony/blob/ve-inheritance-proxy/src/Symfony/Component/VarExporter/README.md) for the record:
    
    >The component provides two lazy loading patterns: ghost objects and virtual proxies (see https://martinfowler.com/eaaCatalog/lazyLoad.html for reference.)
    >
    >Ghost objects work only on concrete and non-internal classes. In the generic case, they are not compatible with using factories in their initializer.
    >
    >Virtual proxies work on concrete, abstract or internal classes. They provide an API that looks like the actual objects and forward calls to them. They can cause identity problems because proxies might not be seen as equivalents to the actual objects.
    >
    >Because of this identity problem, ghost objects should be preferred when possible. Exceptions thrown by the ProxyHelper class can help decide when it can be used or not.
    >
    >Ghost objects and virtual proxies both provide implementations for the LazyObjectInterface which allows resetting them to their initial state or to forcibly initialize them when needed. Note that resetting a ghost object skips its read-only properties. You should use a virtual proxy to reset read-only properties.
    
    Commits
    -------
    
    4862139 [DependencyInjection][VarExporter] Generate lazy proxies for non-ghostable lazy services out of the box
    fabpot committed Sep 3, 2022
  7. [DependencyInjection][VarExporter] Generate lazy proxies for non-ghos…

    …table lazy services out of the box
    nicolas-grekas committed Sep 3, 2022

Commits on Sep 2, 2022

  1. minor #47470 CS fixes (nicolas-grekas)

    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    CS fixes
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | -
    | License       | MIT
    | Doc PR        | -
    
    Commits
    -------
    
    46a6695 CS fixes
    fabpot committed Sep 2, 2022
  2. bug #47468 [HttpKernel] Don't cache controller's reflector inside the…

    … request (nicolas-grekas)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [HttpKernel] Don't cache controller's reflector inside the request
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | yes
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix #47461
    | License       | MIT
    | Doc PR        | -
    
    Issue introduced by #46001
    
    Commits
    -------
    
    c751bd0 [HttpKernel] Don't cache controller's reflector inside the request
    fabpot committed Sep 2, 2022
  3. minor #47469 [FrameworkBundle] tweak the factory class description fo…

    …r inlined factory services (xabbuh)
    
    This PR was merged into the 4.4 branch.
    
    Discussion
    ----------
    
    [FrameworkBundle] tweak the factory class description for inlined factory services
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 4.4
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix #47351 (comment)
    | License       | MIT
    | Doc PR        |
    
    Commits
    -------
    
    5f0a5b4 tweak the factory class description for inlined factory services
    fabpot committed Sep 2, 2022
  4. bug #47463 [Console] [Completion] Make fish completion run in non int…

    …eractive mode (Seldaek)
    
    This PR was merged into the 6.1 branch.
    
    Discussion
    ----------
    
    [Console] [Completion] Make fish completion run in non interactive mode
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.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       | 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 -->
    
    Port #47394 to 6.1 for fish
    
    Commits
    -------
    
    25ab956 [Console] [Completion] Make fish completion run in non interactive mode
    fabpot committed Sep 2, 2022
  5. bug #47464 [Console] [Completion] Make zsh completion run in non inte…

    …ractive mode (Seldaek)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Console] [Completion] Make zsh completion run in non interactive mode
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | yes
    | New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
    | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
    | 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 -->
    
    Port #47394 to 6.2 for zsh
    
    Commits
    -------
    
    4e5add4 [Console] [Completion] Make zsh completion run in non interactive mode
    fabpot committed Sep 2, 2022
  6. CS fixes

    nicolas-grekas committed Sep 2, 2022
  7. minor #47458 [FrameworkBundle] fix tests on Windows (xabbuh)

    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [FrameworkBundle] fix tests on Windows
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       |
    | License       | MIT
    | Doc PR        |
    
    Commits
    -------
    
    8b54f40 fix tests on Windows
    xabbuh committed Sep 2, 2022
  8. bug #47394 [Console] [Completion] Make bash completion run in non int…

    …eractive mode (Seldaek)
    
    This PR was merged into the 5.4 branch.
    
    Discussion
    ----------
    
    [Console] [Completion] Make bash completion run in non interactive mode
    
    | 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       | 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 -->
    
    Refs composer/composer#11024
    
    Composer does prompt in some contexts, and that blocks/freezes the completion as it runs in an interactive context but is not actually visible. Explicitly setting it to be non interactive seems to be the fix to me.
    
    TODO:
    
    - [ ] A similar fix probably should be applied to other completion types supported in newer versions than 5.4
    
    Commits
    -------
    
    cf0b56f Make bash completion run in non interactive mode
    fabpot committed Sep 2, 2022
  9. fix tests on Windows

    xabbuh committed Sep 2, 2022
  10. minor #47449 Fix typo in method retrySpecificEnvelopes (Jeroeny)

    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    Fix typo in method retrySpecificEnvelopes
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | yes
    | New feature?  | no
    | Deprecations? | no
    | Tickets       | Fix for #39622
    | License       | MIT
    
    Commits
    -------
    
    e5675ac fix typo in method retrySpecificEnvelopes
    xabbuh committed Sep 2, 2022
  11. Merge branch '6.1' into 6.2

    * 6.1:
      [Mime] Fix TextPart broken after being serialized
      [String] CamelCase/SnakeCase on uppercase word
    fabpot committed Sep 2, 2022
  12. Merge branch '6.0' into 6.1

    * 6.0:
      [Mime] Fix TextPart broken after being serialized
      [String] CamelCase/SnakeCase on uppercase word
    fabpot committed Sep 2, 2022
  13. Merge branch '5.4' into 6.0

    * 5.4:
      [Mime] Fix TextPart broken after being serialized
      [String] CamelCase/SnakeCase on uppercase word
    fabpot committed Sep 2, 2022
  14. bug #47455 [Mime] Fix TextPart broken after being serialized (fabpot)

    This PR was merged into the 5.4 branch.
    
    Discussion
    ----------
    
    [Mime] Fix TextPart broken after being serialized
    
    | 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       | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
    | License       | MIT
    | Doc PR        | n/a
    
    When serializing a TextPart, it's broken as we change the body to a string but we don't reset the seekable property (this property was introduced in 5.4).
    
    Commits
    -------
    
    a1a1609 [Mime] Fix TextPart broken after being serialized
    fabpot committed Sep 2, 2022
  15. minor #47457 [Mailer] Fix test (fabpot)

    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Mailer] Fix test
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       |
    | License       | MIT
    | Doc PR        |
    
    finishes #47444
    
    Commits
    -------
    
    9c117b2 Fix test
    xabbuh committed Sep 2, 2022
  16. Fix test

    fabpot authored and xabbuh committed Sep 2, 2022

Commits on Sep 1, 2022

  1. feature #39622 [Messenger] Be able to get raw data when a message in …

    …not decodable by the PHP Serializer (lyrixx)
    
    This PR was merged into the 6.2 branch.
    
    Discussion
    ----------
    
    [Messenger] Be able to get raw data when a message in not decodable by the PHP Serializer
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | yes
    | New feature?  | yes
    | Deprecations? | no
    | Tickets       |
    | License       | MIT
    | Doc PR        |
    
    ---
    
    It's easier to review the pr with [`?w=1`](https://github.com/symfony/symfony/pull/39622/files?w=1)
    
    ---
    
    ## Why?
    
    This PR aimed to handle properly messaged that are already failed and also **not decodable** anymore.
    
    This use case occurs when a Message class is renamed / moved to another namespace
    
    ## Reproducer
    
    1. Publish many message of type `App\Message\Foobar`
    1. Consume them all, but throw an Exception exception in the handler
    1. Renamed `Foobar` to `Foo`
    
    ## Before / After
    
    ### command `messenger:failed:show`
    
    #### Before
    
    ##### Without an ID
    
    ```
    …abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:show
    There are 94 messages pending in the failure transport.
    
    In PhpSerializer.php line 84:
    
      Message class "App\Message\Foobar" not found during decoding.
    
    messenger:failed:show [--max MAX] [--transport [TRANSPORT]] [--stats] [--class-filter CLASS-FILTER] [--] [<id>]
    ```
    
    And this **message is lost**
    
    ##### With an ID
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:show 68
    There are 93 messages pending in the failure transport.
    
    In PhpSerializer.php line 84:
    
      Message class "App\Message\Foobar" not found during decoding.
    
    messenger:failed:show [--max MAX] [--transport [TRANSPORT]] [--stats] [--class-filter CLASS-FILTER] [--] [<id>]
    ```
    
    **Message lost too**
    
    #### After
    
    ##### Without an ID
    
    ```
    >…goire/dev/labs/symfony/symfony-5.2(remaned) bin/console  messenger:failed:show
    There are 94 messages pending in the failure transport.
     ----- ------------------------ --------------------- ---------------------------------------
      Id    Class                    Failed at             Error
     ----- ------------------------ --------------------- ---------------------------------------
      62    __PHP_Incomplete_Class   2022-08-12 16:26:06   FoobarHandler is not implemented yet.
      63    __PHP_Incomplete_Class   2022-08-12 16:26:06   FoobarHandler is not implemented yet.
      64    __PHP_Incomplete_Class   2022-08-12 16:26:06   FoobarHandler is not implemented yet.
    
     // Showing first 50 messages.
    
     // Run messenger:failed:show {id} --transport=failed -vv to see message details.
    
    ```
    
    **No messages are lost**
    
    ##### With an ID
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:show 69
    There are 92 messages pending in the failure transport.
    
    Failed Message Details
    ======================
    
     ------------- ---------------------------------------
      Class         __PHP_Incomplete_Class
      Message Id    69
      Failed at     2022-08-12 16:26:06
      Error         FoobarHandler is not implemented yet.
      Error Code    0
      Error Class   Exception
      Transport     async
     ------------- ---------------------------------------
    
     Message history:
      * Message failed at 2022-08-12 16:25:58 and was redelivered
      * Message failed at 2022-08-12 16:25:59 and was redelivered
      * Message failed at 2022-08-12 16:26:02 and was redelivered
      * Message failed at 2022-08-12 16:26:06 and was redelivered
    
     [ERROR] The message could not be decoded.
    
     Re-run command with -vv to see more message & error details.
    
     Run messenger:failed:retry 69 --transport=failed to retry this message.
     Run messenger:failed:remove 69 --transport=failed to delete it.
    ```
    
    **messages not lost**
    
    ##### With an ID an -vv
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:show 69 -vv
    There are 92 messages pending in the failure transport.
    
    Failed Message Details
    ======================
    
     ------------- ---------------------------------------
      Class         __PHP_Incomplete_Class
      Message Id    69
      Failed at     2022-08-12 16:26:06
      Error         FoobarHandler is not implemented yet.
      Error Code    0
      Error Class   Exception
      Transport     async
     ------------- ---------------------------------------
    
     Message history:
      * Message failed at 2022-08-12 16:25:58 and was redelivered
      * Message failed at 2022-08-12 16:25:59 and was redelivered
      * Message failed at 2022-08-12 16:26:02 and was redelivered
      * Message failed at 2022-08-12 16:26:06 and was redelivered
    
    Message:
    ========
    
     [ERROR] The message could not be decoded. See below an APPROXIMATIVE representation of the class.
    
    __PHP_Incomplete_Class(App\Message\Foobar) {}
    
    Exception:
    ==========
    
    Exception^ {
      message: "FoobarHandler is not implemented yet."
      code: 0
      file: "/home/gregoire/dev/labs/symfony/messenger-class-not-found/src/MessageHandler/FoobarHandler.php"
      line: 12
      trace: {
        /home/gregoire/dev/labs/symfony/messenger-class-not-found/src/MessageHandler/FoobarHandler.php:12
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php:95 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php:71 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/FailedMessageProcessingMiddleware.php:34 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/DispatchAfterCurrentBusMiddleware.php:68 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php:41 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/AddBusNameStampMiddleware.php:37 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Middleware/TraceableMiddleware.php:43 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/MessageBus.php:73 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/TraceableMessageBus.php:41 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/RoutableMessageBus.php:54 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Worker.php:156 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Worker.php:105 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php:223 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Console/Command/Command.php:309 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Console/Application.php:1019 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:94 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Console/Application.php:300 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Console/Application.php:172 { …}
        /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Component/Runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …}
        ./vendor/autoload_runtime.php:29 { …}
        ./bin/console:11 { …}
      }
    }
    
     Run messenger:failed:retry 69 --transport=failed to retry this message.
     Run messenger:failed:remove 69 --transport=failed to delete it.
    ```
    
    <details>
    <summary>screenshot with colors</summary>
    
    ![screenshot with colors](https://user-images.githubusercontent.com/408368/187463971-a5464683-f826-4dcb-a2c2-79f91cb00bc0.png)
    
    </details>
    
    **messages not lost**
    
    ### command `messenger:failed:retry`
    
    #### Before
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:retry 69
    
     // Quit this command with CONTROL-C.
    
     // Re-run the command with a -vv option to see logs about consumed messages.
    
    There are 92 messages pending in the failure transport.
    To retry all the messages, run messenger:consume failed
    
    In PhpSerializer.php line 84:
    
      Message class "App\Message\Foobar" not found during decoding.
    
    messenger:failed:retry [--force] [--transport [TRANSPORT]] [--] [<id>...]
    ```
    
    **And the first message is lost**
    
    Same if I use an ID
    
    #### After
    
    ##### Without ID
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:retry
    
     // Quit this command with CONTROL-C.
    
     // Re-run the command with a -vv option to see logs about consumed messages.
    
    There are 91 messages pending in the failure transport.
    To retry all the messages, run messenger:consume failed
    
    Failed Message Details
    ======================
    
     ------------- ---------------------------------------
      Class         __PHP_Incomplete_Class
      Message Id    63
      Failed at     2022-08-12 16:26:06
      Error         FoobarHandler is not implemented yet.
      Error Code    0
      Error Class   Exception
      Transport     async
     ------------- ---------------------------------------
    
     Message history:
      * Message failed at 2022-08-12 16:25:58 and was redelivered
      * Message failed at 2022-08-12 16:25:59 and was redelivered
      * Message failed at 2022-08-12 16:26:02 and was redelivered
      * Message failed at 2022-08-12 16:26:06 and was redelivered
    
     [ERROR] The message could not be decoded.
    
     Re-run command with -vv to see more message & error details.
    
    In FailedMessagesRetryCommand.php line 176:
    
      The message with id "63" could not decoded, it can only be shown or removed.
    
    messenger:failed:retry [--force] [--transport [TRANSPORT]] [--] [<id>...]
    ```
    
    **And the message is not lost**
    
    ##### With an ID
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:retry  63
    
     // Quit this command with CONTROL-C.
    
     // Re-run the command with a -vv option to see logs about consumed messages.
    
    There are 91 messages pending in the failure transport.
    To retry all the messages, run messenger:consume failed
    
    Failed Message Details
    ======================
    
     ------------- ---------------------------------------
      Class         __PHP_Incomplete_Class
      Message Id    63
      Failed at     2022-08-12 16:26:06
      Error         FoobarHandler is not implemented yet.
      Error Code    0
      Error Class   Exception
      Transport     async
     ------------- ---------------------------------------
    
     Message history:
      * Message failed at 2022-08-12 16:25:58 and was redelivered
      * Message failed at 2022-08-12 16:25:59 and was redelivered
      * Message failed at 2022-08-12 16:26:02 and was redelivered
      * Message failed at 2022-08-12 16:26:06 and was redelivered
    
     [ERROR] The message could not be decoded.
    
     Re-run command with -vv to see more message & error details.
    
    In FailedMessagesRetryCommand.php line 176:
    
      The message with id "63" could not decoded, it can only be shown or removed.
    
    messenger:failed:retry [--force] [--transport [TRANSPORT]] [--] [<id>...]
    ```
    
    ### command `messenger:failed:remove`
    
    #### Before
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:remove  63
    
    In PhpSerializer.php line 84:
    
      Message class "App\Message\Foobar" not found during decoding.
    
    messenger:failed:remove [--force] [--transport [TRANSPORT]] [--show-messages] [--] <id>...
    ```
    
    The message is lost, but it's not an issue I guess :p
    
    #### After
    
    ```
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:remove  69
    
     [ERROR] The message with id "69" was not found.
    
    >…abs/symfony/messenger-class-not-found(new) bin/console  messenger:failed:remove  79
    
    Failed Message Details
    ======================
    
     ------------- ---------------------------------------
      Class         __PHP_Incomplete_Class
      Message Id    79
      Failed at     2022-08-12 16:26:06
      Error         FoobarHandler is not implemented yet.
      Error Code    0
      Error Class   Exception
      Transport     async
     ------------- ---------------------------------------
    
     Message history:
      * Message failed at 2022-08-12 16:25:58 and was redelivered
      * Message failed at 2022-08-12 16:25:59 and was redelivered
      * Message failed at 2022-08-12 16:26:02 and was redelivered
      * Message failed at 2022-08-12 16:26:06 and was redelivered
    
     [ERROR] The message could not be decoded.
    
     Re-run command with -vv to see more message & error details.
    
     Do you want to permanently remove this message? (yes/no) [no]:
     > yes
    
     [OK] Message with id 79 removed.
    ```
    
    ---
    
    ## Extra
    
    ### `messenger:consume` command
    
    This command is not fixed on purpose: We keep the default behavior to keep a BC.
    
    **BUT** I would like to use the same stamp system I introduce to avoid loosing a message.
    Because ATM, when a DecodeException is thrown, the message is lost. Not cool!
    
    ```
    >…goire/dev/labs/symfony/symfony-5.2(remaned) bin/console  messenger:consume failed
    
     [OK] Consuming messages from transports "failed".
    
     // The worker will automatically exit once it has received a stop signal via the messenger:stop-workers command.
    
     // Quit the worker with CONTROL-C.
    
     // Re-run the command with a -vv option to see logs about consumed messages.
    
    In PhpSerializer.php line 92:
    
      Message class "App\Message\Foobar" not found during decoding.
    
    ```
    
    Commits
    -------
    
    34229af [Messenger] Be able to get raw data when a message in not decodable by the PHP Serializer
    fabpot committed Sep 1, 2022
  2. minor #47401 Replace get_class() calls by ::class (deguif)

    This PR was squashed before being merged into the 6.2 branch.
    
    Discussion
    ----------
    
    Replace get_class() calls by ::class
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 6.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Tickets       |
    | License       | MIT
    | Doc PR        |
    
    Replace `get_class()` by `::class`
    
    Commits
    -------
    
    675601b Replace get_class() calls by ::class
    fabpot committed Sep 1, 2022
  3. Replace get_class() calls by ::class

    deguif authored and fabpot committed Sep 1, 2022
Older