Review main Merged

82511[TASK] Doctrine DBAL 3.2 Connection::lastInsertId() mitigation

Stefan Bürk CR +2 V +2 Normal +56 −37 updated 01/18/24, 18:42

Commit message

The usage of `Connection::lastInsertId()` with a sequence name
is deprecated as unsafe in scenarios with multiple concurrent
connections since Doctrine DBAL 3.2. If a newly inserted row
needs to be referenced, it is recommended to generate its
identifier explicitly prior to insertion.

This change adjusts the usages to avoid calling the method with
the `$name` and/or the TYPO3 additional `$fieldName` argument.

The method signature is not adjusted yet, due to the bounding
to the extended connection method signature.

[1] https://github.com/doctrine/dbal/blob/3.8.x/UPGRADE.md#deprecated-connectionlastinsertidname

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 27

Show 7 more files

Review log 1318

  1. Stefan Bürk uploaded patch set 1 01/18/24, 12:11

  2. Stefan Bürk wrote 01/18/24, 12:12

    Topic set to doctrine-dbal
  3. core-ci voted on patch set 1 V -1 01/18/24, 12:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51749

  4. Stefan Bürk uploaded patch set 2 V -1 01/18/24, 12:17

  5. Stefan Bürk uploaded patch set 3 01/18/24, 12:25

  6. core-ci voted on patch set 2 V -1 01/18/24, 12:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51750

  7. core-ci voted on patch set 3 V +1 01/18/24, 12:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51751

  8. Stefan Bürk uploaded patch set 4 V +1 01/18/24, 14:41

  9. core-ci voted on patch set 4 V +1 01/18/24, 14:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51761

  10. Oliver Klee voted on patch set 4 V +1 01/18/24, 14:57

  11. Oliver Klee commented on patch set 4 01/18/24, 15:04

    Connection.php:441

    ```php @return numeric-string ```

    ConnectionTest.php:40

    ``` public function lastInsertIdReturnsNextConsecutiveUid(): void ```

    ConnectionTest.php:51

    Let's check for the actual type instead: ```php self::assertSame('5', $connection->lastInsertId()); ```
  12. Stefan Bürk uploaded patch set 5 V +1 01/18/24, 16:54

  13. Stefan Bürk commented on patch set 5 01/18/24, 16:55

    Connection.php:441 Reply

    Done

    ConnectionTest.php:40 Reply

    "next" consecutive is technically wrong. If "5" is used (autoincrement) "6" would be the "next". Used `lastInsertIdReturnsExpectedConsecutiveUid` instead as name as a compromise. Fine for you ?

    ConnectionTest.php:51 Reply

    Done
  14. core-ci voted on patch set 5 V +1 01/18/24, 17:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51771

  15. Christian Kuhn commented on patch set 5 CR +1 V +1 01/18/24, 17:43

    ConnectionTest.php:40 Reply

    Done
  16. Garvin Hicking voted on patch set 5 CR +1 V +1 01/18/24, 18:36

  17. Stefan Bürk voted on patch set 5 CR +2 V +2 01/18/24, 18:42

  18. Stefan Bürk merged patch set 6 01/18/24, 18:42