Project

General

Profile

Actions

Bug #92194

closed

ContentObjectRenderer wraps <img> tags in <p> tags

Added by Reindl Bernd over 3 years ago. Updated 10 months ago.

Status:
Resolved
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-09-04
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

$this->_parseFunc($data, $tagConfig) in ContentObjectRenderer::_parseFunc() where the tags are parsed returns a string wrapped in <p></p>.
E.G. $tag is img $data = $this->_parseFunc($data, $conf); returns <p><img .....></p> but should return <img ....>.

I Think this happens because $data = $this->_parseFunc($data, $conf); uses $conf als param. But i think it should use $tagConfig instead.

if (strpos($data, '<') !== false && isset($conf['tags.']) && is_array($conf['tags.'])) {
    foreach ($conf['tags.'] as $tag => $tagConfig) {
                            // only match tag `a` in `<a href"...">` but not in `<abbr>`
                            if (preg_match('#<' . $tag . '[\s/>]#', $data)) {
                                $data = $this->_parseFunc($data, $conf);
                                break;
                            }
                        }
                    }
if (strpos($data, '<') !== false && isset($conf['tags.']) && is_array($conf['tags.'])) {
                        foreach ($conf['tags.'] as $tag => $tagConfig) {
                            // only match tag `a` in `<a href"...">` but not in `<abbr>`
                            if (preg_match('#<' . $tag . '[\s/>]#', $data)) {
                                $data = $this->_parseFunc($data, $tagConfig);
                                break;
                            }
                        }
                    }

Files

rte_ckeditor_image.zip (644 KB) rte_ckeditor_image.zip Reindl Bernd, 2021-01-22 06:52

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #39261: parseFunc does not handle nested tags correctClosed2012-07-25

Actions
Actions

Also available in: Atom PDF