Issue Bug Closed

#14977Function 'getBorderAttr' for removing 'border="0"' from img-tags doesn't work

Franz Koch 09/18/05, 22:50 updated 08/12/06, 14:23

Description

By validating my website I found out, that typo3 automatically renders the parameter ‘border=“0”’ into img-tags. On my search to remove those, I found the function ‘getBorderAttr’ which should remove those attributes if a special doctype is set, or if the variable ‘disableImgBorderAttr’ is set. But the function has a logical error in the if-clause, so that the parameter only gets removed when both clauses are true insted of one of them.

BUG:
function: ‘getBorderAttr’
file: ‘class.tslib_content.php’
lines: 2511-2521

wrong (line 2518):
————
if (!t3lib_div::inList(‘xhtml_strict,xhtml_11,xhtml_2’,$GLOBALS[‘TSFE’]->config[‘config’][‘doctype’]) || $GLOBALS[‘TSFE’]->config[‘config’][‘disableImgBorderAttr’]) {
————

correct:
————
if (!t3lib_div::inList(‘xhtml_strict,xhtml_11,xhtml_2’,$GLOBALS[‘TSFE’]->config[‘config’][‘doctype’]) && !$GLOBALS[‘TSFE’]->config[‘config’][‘disableImgBorderAttr’]) {
————

Here the complete working function:
———————————
/** * Returns the ‘border’ attribute for an tag only if the doctype is not xhtml_strict,xhtml_11 or xhtml_2 or if the config parameter ‘disableImgBorderAttr’ is not set. * * param string the border attribute * return string the border attribute
*/
function getBorderAttr($borderAttr) {
if (!t3lib_div::inList(‘xhtml_strict,xhtml_11,xhtml_2’,$GLOBALS[‘TSFE’]->config[‘config’][‘doctype’]) && !$GLOBALS[‘TSFE’]->config[‘config’][‘disableImgBorderAttr’]) {
return $borderAttr;
}
}
(issue imported from #M1461)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.