Bug #94707

Undefined array key / Trying to access array offset on value of type null / PHP Version 8.0.8

Added by Michael Kasten 4 months ago. Updated about 2 months ago.

Status:
Accepted
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2021-08-04
Due date:
% Done:

0%

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

Description

PHP version: 8.0.8
PHP CGI detected: Yes
Version: MySQL 5.5.5-10.3.29-MariaDB-0+deb10u1

These Errormessages are flooding the Logtable, getting multiple errors like this in one second, setting debug presett will breake the frontend.

Core: Error handler (BE): PHP Warning: Undefined array key "tx_news_pi1" in typo3_src-11.3.1/vendor/symfony/expression-language/Node/GetAttrNode.php line 97 
Core: Error handler (BE): PHP Warning: Undefined array key "defaultContentRendering" in typo3_src-11.3.1/typo3/sysext/core/Classes/TypoScript/Parser/TypoScriptParser.php line 957 
Core: Error handler (FE): PHP Warning: Undefined array key "excludeFromConcatenation" in typo3_src-11.3.1/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 447

Same Projekt running under PHP 7.4.3 dosnt show these errors so i guess its a Problem with the PHP Version

Confusing about the tx_news_pi1 error because there is no news extension installed

Is 11.3.1 realy PHP 8.0.x ready?


Files

env.png (22.1 KB) env.png Xavier Perseguers, 2021-10-08 07:01

Related issues

Related to TYPO3 Core - Bug #95082: Add fallback for undefined key in RequestHandler/TypoScriptFrontendControllerClosed2021-09-02

Actions
Related to TYPO3 Core - Bug #95536: Undefined array key when cut ce in list view and paste in page viewResolved2021-10-08

Actions
Related to TYPO3 Core - Bug #95563: Undefined key warnings in ContentObjectRenderer.phpResolved2021-10-11

Actions
#1

Updated by Oliver Bartsch 4 months ago

Hi, regarding

Core: Error handler (BE): PHP Warning: Undefined array key "tx_news_pi1" in typo3_src-11.3.1/vendor/symfony/expression-language/Node/GetAttrNode.php line 97 

this does not mean EXT:news is installed but that your installation contains a TypoScript Condition with tx_news_pi1 as array key. Maybe something like:

request.getQueryParams()['tx_news_pi1'] == 1
#2

Updated by Benni Mack 3 months ago

  • Target version changed from 11.4 to 11 LTS
#3

Updated by Michael Kasten 3 months ago

Hi,

@oliver: your right there was a condition left for ext news, removed and this error was fixed!

I'm testing today with the 11.4 release, the log show me more and more "undefined key array" issues

PHP Warning: Undefined array key "allWrap" in /var/www/html/typo3_src-11.4.0/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 446     

$cssFileConfig['allWrap'],
PHP Warning: Undefined array key "forceOnTop" in /var/www/html/typo3_src-11.4.0/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 445     

(bool)$cssFileConfig['forceOnTop']

PHP Warning: Undefined array key "inline" in /var/www/html/typo3_src-11.4.0/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 444     

(bool)$cssFileConfig['inline']
PHP Warning: Undefined array key "external" in /var/www/html/typo3_src-11.4.0/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 444     

$cssFileConfig['external']

PHP Warning: Undefined array key "title" in /var/www/html/typo3_src-11.4.0/typo3/sysext/frontend/Classes/Http/RequestHandler.php line 443     

$cssFileConfig['title']

All this warnings are shown as errors inside the Logfile, the Problem is: Calling a page for the frontend will produce ~70 Logentries in one second so the Log table was flooded by the time (i know that there is a scheduler command for clearing, but it is difficult to see real problem with all these stuff inside the Logtable)

the example above ist touching the css processing (line 414:456) the same problem exists on the js processing also

I guess there a some proofs neccessary like

if(isset($table[$key])) {

or better

$table[$key] = $table[$key] ?? null;
#4

Updated by Jochen Roth 3 months ago

  • Related to Bug #95082: Add fallback for undefined key in RequestHandler/TypoScriptFrontendController added
#5

Updated by Benni Mack 2 months ago

  • Target version changed from 11 LTS to Candidate for patchlevel
#6

Updated by Jochen Roth about 2 months ago

@Michael, this should be fixed in 11.5

Can you please verify? Thank you.

#7

Updated by Xavier Perseguers about 2 months ago

I've got a similar error:

PHP Warning: Undefined array key "tt_content" 

while trying to cut/paste a content element from one page to another one, thus in Backend.

#8

Updated by Xavier Perseguers about 2 months ago

Now that I moved my content element manually in database, I have another error while using Web > Page:

PHP Warning: Undefined array key "mode" in /path/to/private/typo3/sysext/backend/Classes/Controller/PageLayoutController.php line 648
#9

Updated by Xavier Perseguers about 2 months ago

  • File env.png env.png added
  • Status changed from New to Accepted
  • Priority changed from Should have to Must have
  • Target version changed from Candidate for patchlevel to next-patchlevel

Environment:

#10

Updated by Jochen Roth about 2 months ago

Xavier Perseguers wrote in #note-7:

I've got a similar error:

[...]

while trying to cut/paste a content element from one page to another one, thus in Backend.

This is already fixed in latest master:
https://github.com/TYPO3/typo3/blob/master/typo3/sysext/backend/Classes/Controller/SimpleDataHandlerController.php#L270

#11

Updated by Jochen Roth about 2 months ago

  • Related to Bug #95536: Undefined array key when cut ce in list view and paste in page view added
#12

Updated by Jochen Roth about 2 months ago

Xavier Perseguers wrote in #note-8:

Now that I moved my content element manually in database, I have another error while using Web > Page:

[...]

This patch will fix the undefined mode:w
https://review.typo3.org/c/Packages/TYPO3.CMS/+/71504

#13

Updated by Michael Kasten about 2 months ago

Jochen Fröhlich i guess these errors are fixed but there are some more issues with this behaviour:


Undefined array key "typolink." in /var/www/html/typo3_src-11.5.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 1043 

$content = (string)$this->typoLink($string, $conf['typolink.']);

#maybe should be

$content = (string)$this->typoLink($string, $conf['typolink.'] ?? []);

Undefined array key "crop" in /var/www/html/typo3_src-11.5.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 1070

$conf[$parameterName] = $this->stdWrap($conf[$parameterName], $conf[$parameterName . '.']);

#maybe should be

$conf[$parameterName] = $this->stdWrap($conf[$parameterName], $conf[$parameterName . '.'] ?? []);

Undefined array key "m." in /var/www/html/typo3_src-11.5.0/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 4084

$maskArray = $fileArray['m.'];

#maybe should be

$maskArray = $fileArray['m.'] ?? [];

Undefined array key "addQueryString" in /var/www/html/typo3_src-11.5.0/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php line 627

$getVars = $this->parent_cObj->getQueryArguments($this->conf['addQueryString.']);

#maybe should be

$getVars = $this->parent_cObj->getQueryArguments($this->conf['addQueryString.'] ?? []);


Undefined array key 1 in /var/www/html/typo3_src-11.5.0/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php line 973 

$endKey = $this->parent_cObj->getKey($begin_end[1], $this->tmpl->rootLine);

#maybe should be

$endKey = $this->parent_cObj->getKey($begin_end[1] ?? [], $this->tmpl->rootLine);

As far as I can see :)

#14

Updated by Jochen Roth about 2 months ago

  • Related to Bug #95563: Undefined key warnings in ContentObjectRenderer.php added
#15

Updated by Jochen Roth about 2 months ago

Michael Kasten wrote in #note-13:

Jochen Fröhlich i guess these errors are fixed but there are some more issues with this behaviour:

[...]

[...]

[...]

[...]

[...]

As far as I can see :)

Moved to #95563 ... can't have all the PHP8 undefined key warning in a single issue. I prefer smaller chunks to work on.

Also available in: Atom PDF