Bug #80806

Upgrade Wizard / Execute database migrations on single rows / Error: The RecordLinkHandler expects identifier and uid as $parameter configuration

Added by Christian Toffolo over 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Install Tool
Target version:
Start date:
2017-04-11
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When I run "Upgrade Wizard / Execute database migrations on single rows" I get this error
"The RecordLinkHandler expects identifier and uid as $parameter configuration"

I debugged and found that the upgrade wizard calls $linkService->resolve($link) that returns

$linkParts = [
    type = "record",
    url = [
        identifier = "tx_ianshop",
        table = "tx_ianshop_domain_model_product",
        uid = "2",
    ]
]

with $link="record:tx_ianshop:tx_ianshop_domain_model_product:2"

then calls $linkService->asString($linkParts)
that calls \TYPO3\CMS\Core\LinkHandling\RecordLinkHandler::asString
that expect an array like

$parameters = [
    identifier = "tx_ianshop",
    uid = "2",
]

instead it receives the array $parameters = $linkParts.


Related issues

Related to TYPO3 Core - Bug #79647: Add hooks to enable extension using the old typoLinkHandler syntax to migrate data Closed 2017-02-06
Related to TYPO3 Core - Task #66373: Extend typolink to handle record links Closed 2015-04-10
Related to TYPO3 Core - Task #66374: Ensure the softref parser properly handles record links Closed 2015-04-10
Duplicated by TYPO3 Core - Bug #80807: Upgrade Wizard / Execute database migrations on single rows / Error: The RecordLinkHandler expects identifier and uid as $parameter configuration Closed 2017-04-11

Associated revisions

Revision 4766a6f9 (diff)
Added by Johannes Kasberger 12 months ago

[BUGFIX] Upgrade linkhandler syntax to new link syntax

The \TYPO3\CMS\Core\LinkHandling\RecordLinkHandler::asString method
expects the parameters to hold the identifier and uid as top-level
array elements.
The legacy syntax converter now ensures that this nesting is correct.

Besides that we now also upgrade the very old linkhandler syntax
with no identifier.

Therefore we accept
- record:<identifier>:<table>:<uid>
- record:<table>:<uid>

Resolves: #80806
Releases: master, 8.7
Change-Id: I01c3d525de43a56d610dc882ef406de631a8762e
Reviewed-on: https://review.typo3.org/58964
Tested-by: TYPO3com <>
Reviewed-by: Josef Glatz <>
Tested-by: Josef Glatz <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision f2be991b (diff)
Added by Johannes Kasberger 12 months ago

[BUGFIX] Upgrade linkhandler syntax to new link syntax

The \TYPO3\CMS\Core\LinkHandling\RecordLinkHandler::asString method
expects the parameters to hold the identifier and uid as top-level
array elements.
The legacy syntax converter now ensures that this nesting is correct.

Besides that we now also upgrade the very old linkhandler syntax
with no identifier.

Therefore we accept
- record:<identifier>:<table>:<uid>
- record:<table>:<uid>

Resolves: #80806
Releases: master, 8.7
Change-Id: I01c3d525de43a56d610dc882ef406de631a8762e
Reviewed-on: https://review.typo3.org/59046
Reviewed-by: Andreas Fernandez <>
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Morton Jonuschat over 2 years ago

  • Duplicated by Bug #80807: Upgrade Wizard / Execute database migrations on single rows / Error: The RecordLinkHandler expects identifier and uid as $parameter configuration added

#2 Updated by Benni Mack over 2 years ago

  • Target version changed from 8 LTS to next-patchlevel

#3 Updated by Bernhard Eckl over 2 years ago

Same here when upgrading from 7.6.16 to 8.7.2.
I have the linkhandler extension installed.

#4 Updated by Christoph Lehmann over 2 years ago

A little bit lazy, but works with

if (empty($parameters['identifier']) || empty($parameters['uid'])) {
$new = explode(":", $parameters['value']);
if (count($new) == 2) {
$parameters['identifier'] = $new[0];
$parameters['uid'] = $new[1];
}
}

in typo3_src-8.7.4/typo3/sysext/core/Classes/LinkHandling/RecordLinkHandler.php:39

#5 Updated by Christoph Lehmann over 2 years ago

In the end i think it's not really a core issue and more an extension issue.

#6 Updated by Joerg Kummer almost 2 years ago

If you use AOE link handler and have links in your DB entries like

<link record:tx_anyextension_model:123 ...

you need to change these links befor running Upgrade Wizard 'Execute database migrations on single rows' - else this upgrade wizard will never finish its purpose.

#7 Updated by Tobias Schmidt almost 2 years ago

If you're right in the middle of an update and need a quick fix for this problem I recommend to apply the following patch to method transformLinkTagsIfFound in file /typo3/sysext/install/Classes/Updates/RowUpdater/RteLinkSyntaxUpdater.php:180 and run the upgrade wizard again:

$linkParts = $linkService->resolve($link);
if (
    array_key_exists('type', $linkParts) &&
    $linkParts['type'] === LinkService::TYPE_RECORD &&
    array_key_exists('url', $linkParts) &&
    is_array($linkParts['url'])) {
    $linkParts['identifier'] = $linkParts['url']['identifier'];
    $linkParts['uid'] = $linkParts['url']['uid'];
}
$anchorTagAttributes['href'] = $linkService->asString($linkParts);

This just adds an condition to check for links like record:tx_news:tx_news_domain_model_news:1234.

#8 Updated by Marc Bastian Heinrichs over 1 year ago

  • Related to Bug #79647: Add hooks to enable extension using the old typoLinkHandler syntax to migrate data added

#9 Updated by Marc Bastian Heinrichs over 1 year ago

Trapped into this, too. Added my patch to #79647

#10 Updated by J. Peter M. Schuler over 1 year ago

Made #note-7 available as https://github.com/jpmschuler/install/commit/e9d12ba38d30635f02f326b0aeae9458589eaebe.patch for easier composer patching in the meanwhile.

As this Install Tool step is mandatory and it throws an exception just because stupid RTE content exists, it is a core issue IMHO. It is okay to not parse the extensions links at all, but chocking to death is a core issue.

#11 Updated by Tizian Schmidlin over 1 year ago

I can confirm that this issue still exists.

I'd propose that, if this cannot be considered a core issue, an update helper extension is built and distributed with the core update (could be registered as require-dev in composer mode), this would probably help some people.

In the meantime JPM's patch seems to work as expected :-)

#12 Updated by Markus Gehrig about 1 year ago

If the bugfix of Tobias Schmidt and J. Peter M. Schuler isn't working try following Patch:

if (
   array_key_exists('type', $linkParts) &&
   $linkParts['type'] === LinkService::TYPE_RECORD  &&
   array_key_exists('url', $linkParts)  &&
   is_array($linkParts['url'])
   ) {
   $linkPartsClean['identifier'] = $linkParts['url']['identifier'];
   $linkPartsClean['uid'] = $linkParts['url']['uid'];

   $linkParts = $linkPartsClean;
}

$anchorTagAttributes['href'] = $linkService->asString($linkParts);

#13 Updated by Markus Klein about 1 year ago

  • Status changed from New to Accepted
  • Assignee set to Markus Klein

This is a core bug. Issue confirmed.

#14 Updated by Markus Klein 12 months ago

  • Related to Task #66373: Extend typolink to handle record links added

#15 Updated by Markus Klein 12 months ago

  • Related to Task #66374: Ensure the softref parser properly handles record links added

#16 Updated by Gerrit Code Review 12 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58964

#17 Updated by Gerrit Code Review 12 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58964

#18 Updated by Gerrit Code Review 12 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58964

#19 Updated by Gerrit Code Review 12 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58964

#20 Updated by Gerrit Code Review 12 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58964

#21 Updated by Johannes Kasberger 12 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#22 Updated by Gerrit Code Review 12 months ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59046

#23 Updated by Johannes Kasberger 12 months ago

  • Status changed from Under Review to Resolved

#24 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF