Bug #14977

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

Added by Franz Koch about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Target version:
-
Start date:
2005-09-18
Due date:
% Done:

0%

TYPO3 Version:
3.8.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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 <img> 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)

class.tslib_content.diff View (2.17 KB) Administrator Admin, 2005-10-20 16:05


Related issues

Duplicated by TYPO3 Core - Bug #14914: config.disableImgBorderAttr should override anything Closed 2005-08-08

History

#1 Updated by Rupert Germann about 14 years ago

hi Franz,

What you suggest will not work as it was intended. With your change the border attrib is only rendered if the doctype AND "disableImgBorderAttr" are both not matching.
The attached patch does it with an OR operation so the border is not rendered if the doctype is among the listed doctypes OR "disableImgBorderAttr" is set.

#2 Updated by Franz Koch about 14 years ago

Hi Rupert,
ups, my fault - don't ask what donkey I'd been riding. Anyway there was a bug :) Thanks for fixing.

#3 Updated by Ernesto Baschny about 14 years ago

As far as I can see:

Koch's patch does !a && !b.
Rupi's patch does !(a || b).

Acording to DeMorgan's law, both should provide the same output. :)

Btw, I already provided this patch (Koch's version) some months ago, see http://bugs.typo3.org/view.php?id=1360

#4 Updated by Franz Koch about 14 years ago

sorry again - now for the duplicate - but I really searched for it. Maybe I should sleep more...

PS: call me Franz :)

#5 Updated by Rupert Germann about 14 years ago

fixed in cvs

Also available in: Atom PDF