Project

General

Profile

Actions

Bug #33220

closed

Empty content object when select.pidInList=0 set in TS

Added by Alain almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
Start date:
2012-01-16
Due date:
% Done:

0%

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

Description

Hello,

I get an empty return value while rendering dropdown list for countries from the static_info_tables extension. I use following TS:

  lib.country = CONTENT
  lib.country {
   table = static_countries
      select {
        pidInList = 0
        orderBy = cn_short_en
        selectFields = uid,cn_iso_3
      }

      ...
  }

While tracking the SELECT query in tslib_content, I found out in tslib_content::getQuery() that the logical operator NOT (!) is used to check all select proporties if they exist. This operator does not differ between 0 and empty.

  foreach($properties as $property) {
    ...

    if(!$conf[$property]) {
      unset($conf[$property]);
    }

    ...
  }

Even select.pidInList = 0 is set in TS, the condition is fulfilled and $conf['pidInList'] is removed.

In next step, $conf['pidInList'] will be compared with ''

  if(!strcmp($conf['pidInList'], '')) {
    $conf['pidInList'] = 'this';
  }

and afterwards 'this' will be replaced with

  $GLOBALS['TSFE']->contentPid

This leads to a wrong SQL-query because the ID of current page (4) is taken instead of the pid value (0) set in TS.

  SELECT cn_iso_3, cn_short_en FROM static_countries WHERE static_countries.pid IN (4) AND static_countries.deleted=0

In my view, it would be more accurate if to use !isset() instead of NOT in the foreach loop. This will exclude the 0 value in TS.

  foreach($properties as $property) {
    ...

-   if(!$conf[$property]) {
+   if(!isset($conf[$property])) {
      unset($conf[$property]);
    }

    ...

Many thanks and best regards,

Alain


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Task #57168: Enable queries using "root" and "-1" for pidInListClosedOliver Hader2014-03-21

Actions
Is duplicate of TYPO3 Core - Bug #31209: CONTENT still can't select records from rootpageClosed2011-10-24

Actions
Is duplicate of TYPO3 Core - Bug #32374: MENU special = updated not working in 4.6ClosedXavier Perseguers2011-12-07

Actions
Actions

Also available in: Atom PDF