Project

General

Profile

Actions

Bug #19974

closed

Empty subpart markers ignored

Added by Robert Lockerbie over 15 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2009-02-06
Due date:
% Done:

0%

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

Description

When using a template with an empty subpart (), that subpart will be ignored and hence no content will be inserted. This usually shows up when using automaketemplate with an empty element (<div id="marker"></div>) which generates an empty subpart.

This seems to be caused by t3lib_parsehtml::getSubpart which will return "" even if a valid (but empty) subpart is found.

if (preg_match('/^([^\<]*\-\-\>)(.*)(\<\!\-\-[^\>]*)$/s', $content, $matches)===1) {
return $matches2;
}

which causes an issue in class tslib_cObj ( around line 2529 and other places similar code is used)

if (is_array($conf['subparts.'])) {
reset($conf['subparts.']);
while(list($theKey,$theValue)=each($conf['subparts.'])) {
if (!strstr($theKey,'.')) {
$subpart = $this->getSubpart($content, $PRE.$theKey.$POST);
if ($subpart) {
$GLOBALS['TSFE']->register['SUBPART_'.$theKey] = $subpart;
$subparts[$theKey]['name'] = $theValue;
$subparts[$theKey]['conf'] = $conf['subparts.'][$theKey.'.'];
}
}
}
}
where the returned subpart is "" (false) and hence the subpart isn't included in the subparts array.

Possible fixes;
Add dummy text to empty subparts
if (preg_match('/^([^\<]*\-\-\>)(.*)(\<\!\-\-[^\>]*)$/s', $content, $matches)===1) {
if(strlen($matches2)==0) $matches2='Dummy Content';
return $matches2;
}
Have getSubpart return boolean false
$subpart !== false...

(issue imported from #M10359)


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #16997: Empty subparts are not replacedClosedChris topher2007-02-16

Actions
Actions

Also available in: Atom PDF