Project

General

Profile

Actions

Bug #14634

closed

Typolink to a page with certain type doesn't work if type is zero

Added by Martin Leim over 19 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2005-04-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
3.7.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Look at the the following typoscript code:

20 = TEXT
20.value = Template wechseln
20.typolink.parameter.data = field:uid
20.typolink.parameter.wrap = |,0

So I want to make a link to the current page with typenumber 0 set ( I needed this to make a link for the user to change the type of the page to 1 and vice versa).
If you enter a number else than 0, all works fine. But 0 doesn't work.

So here is how I solved it:

After some reverse engineering I came across the method "linkData" in class "t3lib_TSTemplate". The typenum given above is passed as the last parameter. In the comment it means:

"If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found."

OK, so far so good. But some lines later, the code (line 1311) is the following:

//line 1310
if (!$typeOverride && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) {
//line 1312

So actually it is not tested on an empty string but on an "empty" value! As PHP interprets 0 as empty (it doesn't get passed as string but as number) the test actually passes and the typenum from forceTypeValue" is inserted.

So I changed the line and now it works:

if ($typeOverride == '' && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) {

Now it's done exactly what is mentioned in the comment.

(issue imported from #M931)


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #16853: t3lib_TStemplate->linkData typeOverride won't always work if override is '0'ClosedOliver Hader2007-01-11

Actions
Actions #1

Updated by Mathias Schreiber over 18 years ago

TYPO3 Version too old.
The reported version is no longer maintained.

If this bug still persists in 4.0.1, please re-open it again and set the field "Product Version" to the corresponding version.

Actions #2

Updated by Thorsten Kahler almost 18 years ago

The bug still exists in branch TYPO3_4-0 and trunk.

Actions #3

Updated by Thorsten Kahler almost 18 years ago

Fixed in branch TYPO_4-0 and trunk.

Actions

Also available in: Atom PDF