contao/import — Issue #2817: A small bug in the documentRoot method of Environment class?
Author: taca
Created: 2011-11-29 20:20:33+00:00
State: open
Labels: Defect, framework

Hi,

While reading Contao's code, I might find a small bug in documentRoot(), a method of Environmeent class.
In system/libraries/Environment.php line 177:

```
$arrSfnSegments = explode('/', strrev($this->scriptFilename()));
```

$arrSfnSegments is a array as its name. But at line 191, it is passed to substr() as first argument after used in foreach statement:

```
$strDocumentRoot = substr($arrSfnSegments, 0, -(strlen($strDocumentRoot) + 1));
```

AFAIK, the first argument of substr() should be string not array.

--- _Originally created on January 21st, 2011, at 06:22am (ID 2817)_