Bug #35868

Unstable condition in Utility\Environment

Added by Adrian Föder over 3 years ago. Updated about 3 years ago.

Status:On Hold Start date:2012-04-11
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

0%

Category:Environment
Target version:-
PHP Version:5.4 Complexity:
Has patch:No Affected Flow version:(any)

Description

TYPO3\FLOW3\Utility\Environment::untangleFilesArray() has the following section:

1        foreach ($convolutedFiles as $firstLevelFieldName => $fieldInformation) {
2            if (!is_array($fieldInformation['error'])) {

the responsible UnitTest reads as followed:

1    public function getRawServerEnvironmentJustReturnsTheSERVERVariable() {
2        $_SERVER = array('foo' => 'bar', 'REQUEST_TIME' => $_SERVER['REQUEST_TIME']);
3        $environment = new \TYPO3\FLOW3\Utility\Environment('Testing');
4        $this->assertEquals($_SERVER, $environment->getRawServerEnvironment());
5    }

so, $convolutedFiles equals that foo => bar array; and $fieldInformation is not an array, but a string.
$fieldInformation['error'] hence results in

> PHP Warning:  Illegal string offset 'error'

Maybe

if (!is_array($fieldInformation['error']))

should be replaced with
if (!isset($fieldInformation['error']))

in order to avoid that.

Seems to be an 5.4 issue because nobody else noticed.


Related issues

related to TYPO3.Flow - Task #36340: Environment class needs to be cleaned up Resolved 2012-04-19

History

#1 Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10552

#2 Updated by Karsten Dambekalns over 3 years ago

  • Category set to Environment
  • Assigned To set to Karsten Dambekalns
  • Target version set to 1.1

#3 Updated by Karsten Dambekalns over 3 years ago

  • Status changed from Under Review to On Hold

The function you change and the test you mention are unrelated - $_SERVER vs. $_FILES - it seems. For $_FILES the 'error' key is always present, thus the extra check is overhead.

I'll keep this one on my list for 5.4 tests, though!

#4 Updated by Karsten Dambekalns about 3 years ago

  • Target version changed from 1.1 to 1.1 RC1

#5 Updated by Karsten Dambekalns about 3 years ago

  • Target version changed from 1.1 RC1 to 1.1
  • Affected Flow version changed from Git master to (any)

#6 Updated by Karsten Dambekalns about 3 years ago

  • Target version deleted (1.1)

Also available in: Atom PDF