[TYPO3-core] RFC #9979: Bug: enableFields doesn't work with boolean as parameter

Michael Knabe t3 at aafhh.de
Thu Nov 19 13:30:08 CET 2009


This is an SVN patch request.

Type: Bugfix

Bugtracker references:
http://bugs.typo3.org/view.php?id=9979

Branch: Trunk

Problem:
According to typo3conf/ext/t3dev/apidocs/tslib_content_api.html
the method enableFields expects a boolean as the second parameter
($show_hidden) but only integers lead to the desired result.
enableFields($table, TRUE) does not work correctly while 
enableFields($table, 1) does.
The reason is found in t3lib_pageSelect::enableFields(), where -1 is
used as the default value for $show_hidden. That default value means
"look in $GLOBALS['TSFE']->showHiddenRecords for the real $show_hidden
value" . The problem is, how $show_hidden is tested for -1:
"$show_hidden==-1" evaluates to TRUE for $show_hidden===TRUE.

Solution:
Change the comparison to identity (===)

Cheers,
Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9979.diff
Type: text/x-patch
Size: 1139 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091119/efc5f708/attachment.bin>


More information about the TYPO3-team-core mailing list