Bug #88015

Can't edit TCA records with language set to All languages(sys_language_uid = -1)

Added by Ricky Mathew 8 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-03-27
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
routing,TCA
Complexity:
easy
Is Regression:
Sprint Focus:

Description

I have lot of TCA records with language set to All languages (sys_language_uid = -1) . But i cant edit the TCA records since it throws the following error:


(1/1) #1522960188 InvalidArgumentException
Language -1 does not exist on site example.

in typo3/sysext/core/Classes/Site/Entity/Site.php line 237

        throw new \InvalidArgumentException(
            'Language ' . $languageId . ' does not exist on site ' . $this->identifier . '.',
            1522960188
        );
    }

The error throws obviously as -1 is not there in the corresponding site configuration.So i added a patch in typo3/sysext/core/Classes/Site/Entity/Site.php as follows and it works and not breaking anything else.

    public function getLanguageById(int $languageId): SiteLanguage
    {
        if (isset($this->languages[$languageId])) {
            return $this->languages[$languageId];
        }
        /**patch to fix editing of TCA records set with All languages(sys_language_uid = -1)**/
        elseif ($languageId == -1) {
            return $this->languages[0];
        }
        throw new \InvalidArgumentException(
            'Language ' . $languageId . ' does not exist on site ' . $this->identifier . '.',
            1522960188
        );
    }

If this solution feels sensible can anyone please push it to the gerrit review.

History

#1 Updated by Ricky Mathew 8 months ago

  • Target version set to next-patchlevel
  • Tags set to routing,TCA

#2 Updated by Benni Mack 7 months ago

  • Status changed from New to Needs Feedback

Hi Ricky,

I need a little bit more information on that. I tried this with a 9.5.5 installation and set a tt_content record to "All languages" no problem so far. However, I have more questions:

a) are you an Admin or Editor?
b) are you using tt_content or a different record?
c) are you storing this in a sys_folder or somewhere else?

can you also give me the full backtrace?

Thanks.
Benni

#3 Updated by Benni Mack 6 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

#4 Updated by Riccardo De Contardi 3 months ago

  • Status changed from Needs Feedback to Closed
  • Target version deleted (Candidate for patchlevel)

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or ping me.

Thank you and best regards

Also available in: Atom PDF