Bug #92790
closedPostFolderRenameSignal has wrong argument in TYPO3 v9
100%
Description
When renaming a folder two signals are sent:
- PreFolderRenameSignal
- PostFolderRenameSignal
Since TYPO3 v10 those signals (refactored as PSR-14) are correctly constructed, the "Pre" contains a reference to the Folder object before the renaming, the "Post" contains the Folder object after the renaming.
But in TYPO3 v9 (and for sure before as well), the "Post" signal still contains a reference to the Folder before the renaming, making this signal +/- totally useless.
This bug should have been spotted and fixed during the development of TYPO3 v10, while migrating to PSR-14.
Updated by Gerrit Code Review about 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66566
Updated by Xavier Perseguers about 4 years ago
In case you need the correct behaviour until the fix is not merged, here is how you should work:
protected static $previousFolder; /** * @param Folder $folder * @param string $newName */ public function preFolderRename(Folder $folder, string $newName): void { static::$previousFolder = $folder; } /** * @param Folder $folder * @param string $newName */ public function postFolderRename(Folder $folder, string $newName): void { if ($folder->getIdentifier() === static::$previousFolder->getIdentifier()) { // This is a known bug: https://forge.typo3.org/issues/92790 $newIdentifier = dirname($folder->getIdentifier()) . '/' . $newName . '/'; $folder = $folder->getStorage()->getFolder($newIdentifier); } // your code here }
Of course, if you know the bug is there (by testing the TYPO3 version), you can just compute the correct new $folder
without relying on the dynamic check.
Updated by Christian Kuhn about 4 years ago
- Related to Bug #84539: SIGNAL_PostFolderRename Bug added
Updated by Gerrit Code Review about 4 years ago
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66566
Updated by Gerrit Code Review about 4 years ago
Patch set 3 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/66566
Updated by Xavier Perseguers about 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset a5bec18b9de8acbe4ed6ddd9636d54588426cfa7.