[TYPO3-core] RFC: #10359: Empty subparts are ignored

Martin Kutschker masi-no at spam-typo3.org
Sat Aug 15 19:29:26 CEST 2009


Jigal van Hemert schrieb:
> This is an SVN patch request.
> 
> Type: Bugfix
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=10359
> 
> Branches: TYPO3_4-2, Trunk
> 
> Problem:
> t3lib_parsehtml::getSubPart() returns an empty string if the subpart
> marker pair is not found, but it also returns an empty string if the
> subpart marker pair is found but there is nothing between the subpart
> markers (or the content is a zero ('0')).
> For code which calls getSubPart() there is no way to distinguish between
> and empty, but existing subpart and a non-existing subpart.
> In many case the return value is evaluated as boolean:
> $html = t3lib_parsehtml::getSubPart($template, $marker);
> if ($html) {
> ....
> So anything between the subpart markers that evaluates to 'false' causes
> the code to think that the subpart markers weren't found at all.
> 
> Solution:
> If the marker-pair is found any content which evaluates to 'false' will
> be replaced with a dummy value (default: '<!-- -->').

How about returning false (the boolean value) if the marker pair wasn't
found? It'll appear as an empty string if used as such, but you can
distinguish the cases.

And of course the literal 0 should be returned.

And of course this cannot go to 4.2 as it is a change, not a bug fix.

Masi


More information about the TYPO3-team-core mailing list