Bug #35868

Unstable condition in Utility\Environment

Added by Adrian Föder over 9 years ago. Updated over 9 years ago.

Status:
On Hold
Priority:
Must have
Category:
Environment
Target version:
-
Start date:
2012-04-11
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.4
Has patch:
No
Complexity:

Description

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

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

the responsible UnitTest reads as followed:

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

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 upResolvedKarsten Dambekalns2012-04-19

Actions
#1

Updated by Gerrit Code Review over 9 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 9 years ago

  • Category set to Environment
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.1
#3

Updated by Karsten Dambekalns over 9 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 over 9 years ago

  • Target version changed from 1.1 to 1.1 RC1
#5

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1.1 RC1 to 1.1
#6

Updated by Karsten Dambekalns over 9 years ago

  • Target version deleted (1.1)

Also available in: Atom PDF