Project

General

Profile

Actions

Bug #14977

closed

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

Added by Franz Koch over 18 years ago. Updated over 17 years ago.

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

0%

Estimated time:
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)


Files

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

Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #14914: config.disableImgBorderAttr should override anythingClosed2005-08-08

Actions
Actions #1

Updated by Rupert Germann over 18 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.

Actions #2

Updated by Franz Koch over 18 years ago

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

Actions #3

Updated by Ernesto Baschny over 18 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

Actions #4

Updated by Franz Koch over 18 years ago

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

PS: call me Franz :)

Actions #5

Updated by Rupert Germann over 18 years ago

fixed in cvs

Actions

Also available in: Atom PDF