Bug #84009

Inserting an invalid url with link wizard throws exception

Added by Sybille Peters almost 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2018-02-22
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
On Location Sprint

Description

I had this problem in the following versions:
  • current master (9.2.0-dev)
  • current TYPO3_8-7 branch (8.7.11-dev)
  • 8.7.10
    (that's all I tested so far)

Steps to reproduce

  1. Insert an invalid url (I used http//abc.de/sfdsf) into a content element with the link wizard (external url)
  2. Save the content element: exception is thrown

(set configuration presets to "debug" to see exception message)

Exception

Exception for 8.7.10:

Uncaught TYPO3 Exception
#1460629247: No valid handlers found for type: unknown (More information)

TYPO3\CMS\Core\LinkHandling\Exception\UnknownLinkHandlerException thrown in file
/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/LinkHandling/LinkService.php in line 155.

18 TYPO3\CMS\Core\LinkHandling\LinkService::asString(array)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/Html/RteHtmlParser.php:
00566:                 } else {
00567:                     // Otherwise store the link as <a> tag as default by TYPO3, with the new link service syntax
00568:                     $tagAttributes['href'] = $linkService->asString($linkInformation);
00569:                     $blockSplit[$k] = '<a ' . GeneralUtility::implodeAttributes($tagAttributes, true) . '>'
00570:                         . $this->TS_links_db($this->removeFirstAndLastTag($blockSplit[$k])) . '</a>';

17 TYPO3\CMS\Core\Html\RteHtmlParser::TS_links_db("<p><a href="http//abc.de/sfdsf">invalid link&nbsp;</a></p>")

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/Html/RteHtmlParser.php:
00230:                             break;
00231:                         case 'ts_links':
00232:                             $value = $this->TS_links_db($value);
00233:                             break;
00234:                         case 'css_transform':

16 TYPO3\CMS\Core\Html\RteHtmlParser::RTE_transform("<p><a href="http//abc.de/sfdsf">invalid link&nbsp;</a></p>", array, "db", array)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01783:             $parseHTML = GeneralUtility::makeInstance(RteHtmlParser::class);
01784:             $parseHTML->init($table . ':' . $field, $realPid);
01785:             $valueArray['value'] = $parseHTML->RTE_transform($value, [], 'db', $richtextConfiguration);
01786:         }
01787: 

15 TYPO3\CMS\Core\DataHandling\DataHandler::checkValueForText("<p><a href="http//abc.de/sfdsf">invalid link&nbsp;</a></p>
↵", array, "tt_content", "NEW5a8e8db2b57d9344844565", 2, "bodytext")

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01656:         switch ($tcaFieldConf['type']) {
01657:             case 'text':
01658:                 $res = $this->checkValueForText($value, $tcaFieldConf, $table, $id, $realPid, $field);
01659:                 break;
01660:             case 'passthrough':

14 TYPO3\CMS\Core\DataHandling\DataHandler::checkValue_SW(array, "<p><a href="http//abc.de/sfdsf">invalid link&nbsp;</a></p>
↵", array, "tt_content", "NEW5a8e8db2b57d9344844565", NULL, "new", 2, NULL, "bodytext", NULL, 2)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01623: 
01624:         // Perform processing:
01625:         $res = $this->checkValue_SW($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $realPid, $recFID, $field, $this->uploadedFileArray[$table][$id][$field], $tscPID);
01626:         return $res;
01627:     }

13 TYPO3\CMS\Core\DataHandling\DataHandler::checkValue("tt_content", "bodytext", "<p><a href="http//abc.de/sfdsf">invalid link&nbsp;</a></p>
↵", "NEW5a8e8db2b57d9344844565", "new", 2, 2)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01513:                     if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
01514:                         // Evaluating the value
01515:                         $res = $this->checkValue($table, $field, $fieldValue, $id, $status, $realPid, $tscPID);
01516:                         if (array_key_exists('value', $res)) {
01517:                             $fieldArray[$field] = $res['value'];

12 TYPO3\CMS\Core\DataHandling\DataHandler::fillInFieldArray("tt_content", "NEW5a8e8db2b57d9344844565", array, array, 2, "new", 2)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/DataHandling/DataHandler.php:
01228:                 }
01229:                 // Processing of all fields in incomingFieldArray and setting them in $fieldArray
01230:                 $fieldArray = $this->fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, $theRealPid, $status, $tscPID);
01231:                 $newVersion_placeholderFieldArray = [];
01232:                 if ($createNewVersion) {

11 TYPO3\CMS\Core\DataHandling\DataHandler::process_datamap()

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:
00575:             // Perform the saving operation with DataHandler:
00576:             $tce->process_uploads($_FILES);
00577:             $tce->process_datamap();
00578:             $tce->process_cmdmap();
00579:             // If pages are being edited, we set an instruction about updating the page tree after this operation.

10 TYPO3\CMS\Backend\Controller\EditDocumentController::processData()

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:
01988:         // Checks, if a save button has been clicked (or the doSave variable is sent)
01989:         if ($this->doProcessData()) {
01990:             $this->processData();
01991:         }
01992: 

9 TYPO3\CMS\Backend\Controller\EditDocumentController::mainAction(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)
8 call_user_func_array(array, array)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Http/RouteDispatcher.php:
00052:         $targetIdentifier = $route->getOption('target');
00053:         $target = $this->getCallableFromTarget($targetIdentifier);
00054:         return call_user_func_array($target, [$request, $response]);
00055:     }
00056: 

7 TYPO3\CMS\Backend\Http\RouteDispatcher::dispatch(TYPO3\CMS\Core\Http\ServerRequest, TYPO3\CMS\Core\Http\Response)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00137:         /** @var RouteDispatcher $dispatcher */
00138:         $dispatcher = GeneralUtility::makeInstance(RouteDispatcher::class);
00139:         return $dispatcher->dispatch($request, $response);
00140:     }
00141: }

6 TYPO3\CMS\Backend\Http\RequestHandler::dispatch(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Http/RequestHandler.php:
00070:         // Check if the router has the available route and dispatch.
00071:         try {
00072:             return $this->dispatch($request);
00073:         } catch (InvalidRequestTokenException $e) {
00074:             // When token was invalid redirect to login

5 TYPO3\CMS\Backend\Http\RequestHandler::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/core/Classes/Core/Bootstrap.php:
00313: 
00314:         // Execute the command which returns a Response object or NULL
00315:         $this->response = $requestHandler->handleRequest($request);
00316:         return $this;
00317:     }

4 TYPO3\CMS\Core\Core\Bootstrap::handleRequest(TYPO3\CMS\Core\Http\ServerRequest)

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Classes/Http/Application.php:
00090:         }
00091: 
00092:         $this->bootstrap->handleRequest($this->request);
00093: 
00094:         if ($execute !== null) {

3 TYPO3\CMS\Backend\Http\Application::run()

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Resources/Private/Php/backend.php:
00022:     $classLoader = require __DIR__ . '/../../../../../../vendor/autoload.php';
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

2 {closure}()

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Resources/Private/Php/backend.php:
00023: 
00024:     (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run();
00025: });

1 require("/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/sysext/backend/Resources/Private/Php/backend.php")

/var/www/t3bare8/htdocs/typo3_src-8.7.10/typo3/index.php:
00001: <?php
00002: 
00003: require __DIR__ . '/sysext/backend/Resources/Private/Php/backend.php';

Associated revisions

Revision 60c01aca (diff)
Added by Benni Mack about 1 year ago

[BUGFIX] Catch Exceptions in RTE with invalid links

Only one area is covered with catching invalid links when setting
an ugly external URL without proper scheme.

The other area is caught now too.

Resolves: #84009
Releases: master, 8.7
Change-Id: Ief7549009b114803daacf39e36528523718a0d36
Reviewed-on: https://review.typo3.org/58746
Tested-by: TYPO3com <>
Reviewed-by: Joerg Kummer <>
Tested-by: Joerg Kummer <>
Reviewed-by: Felix Althaus <>
Tested-by: Felix Althaus <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

Revision 06bd4729 (diff)
Added by Benni Mack about 1 year ago

[BUGFIX] Catch Exceptions in RTE with invalid links

Only one area is covered with catching invalid links when setting
an ugly external URL without proper scheme.

The other area is caught now too.

Resolves: #84009
Releases: master, 8.7
Change-Id: Ief7549009b114803daacf39e36528523718a0d36
Reviewed-on: https://review.typo3.org/58755
Tested-by: TYPO3com <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Sybille Peters almost 2 years ago

  • Description updated (diff)
  • TYPO3 Version changed from 9 to 8

#2 Updated by Sybille Peters almost 2 years ago

  • Description updated (diff)

#3 Updated by Susanne Moog about 1 year ago

  • Sprint Focus set to On Location Sprint

#4 Updated by Gerrit Code Review about 1 year ago

  • Status changed from New 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/58746

#5 Updated by Gerrit Code Review about 1 year ago

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/58755

#6 Updated by Benni Mack about 1 year ago

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

#7 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF