Bug #15158
closedTS_CASE object does support key value 0
0%
Description
the typoscript below does not work because the case object does not honor key values of "0".
- i know the ts is senseless but it demonstrates the problem
page.20 = CASE
page.20 {
key = 00 = TEXT
0.value = null1 = TEXT
1.value = one
}
the only workaround is to use the default key but that makes it necessary to explicitly assign the values of every other key. not very effective and user friendly code if the value 0 is the one to behandled different.
I'm using something like that to reconfigure the tt_content.image settings based on the tt_content.imageorient key.
i will try to examine the core and suggest a patch the next days.
(issue imported from #M1736)
Updated by old_martinficzel about 19 years ago
Index: class.t3lib_tsparser.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/t3lib/class.t3lib_tsparser.php,v
retrieving revision 1.9
diff u -r1.9 class.t3lib_tsparser.php class.t3lib_tsparser.php 1 Apr 2005 14:37:07
--0000 1.9>syntaxHighLight) $this->regHighLight("objstr",$lineP,strlen(substr($line,$varL)));
++ class.t3lib_tsparser.php 28 Oct 2005 16:42:30 -0000@ -233,7 +233,7
@
$varL = strcspn($line,' {=<>('); // Find object name string until we meet an operator VER2: Added '>'!!
$objStrName=trim(substr($line,0,$varL));
if ($this
- if ($objStrName) {
if (isset($objStrName)) {
if ($this->strict && eregi('[^[:alnum:]_\.-]',$objStrName,$r)) {
$this->error('Line '.($this->lineNumberOffset+$this->rawP-1).': Object Name String, "'.htmlspecialchars($objStrName).'" contains invalid character "'.$r0.'". Must be alphanumeric or one of: "_-."');
} else {
Updated by old_martinficzel about 19 years ago
Index: class.tslib_content.php
===================================================================
RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/cms/tslib/class.tslib_content.php,v
retrieving revision 1.76.2.5
diff u -r1.76.2.5 class.tslib_content.php class.tslib_content.php 22 May 2005 18:31:12
--0000 1.76.2.5>checkIf($conf['if.'])) {
++ class.tslib_content.php 28 Oct 2005 16:44:20 -0000@ -1457,7 +1457,7
@
if ($this
if ($conf['setCurrent'] || $conf['setCurrent.']){$this->data[$this->currentValKey] = $this->stdWrap($conf['setCurrent'], $conf['setCurrent.']);}
$key = $this->stdWrap($conf['key'],$conf['key.']);
- $key = $conf[$key] ? $key : 'default';
$key = isset($conf[$key]) ? $key : 'default';
$name = $conf[$key];
$theValue = $this->cObjGetSingle($name,$conf[$key.'.'], $key);
if ($conf['stdWrap.']) {
Updated by old_martinficzel about 19 years ago
in both cases the values arre checked wrong
1st
the ts parser does not honor the string "0". the statement if ($object) returns false if the given string is "0" better user if ( isset($object))
2nd
the tslib_content does check the existance of a configuration value in the same way if ($conf[$key]) i suggest to use( if (isset($conf[$key])) instead
Updated by Stanislas Rolland over 18 years ago
Fixed in TYPO3core CVS, branch TYPO3_4-0.