contao/core — Issue #3693: Bug in getting value from File class object after renaming the file
Author: DyaGa
Created: 2011-12-14 21:18:42+00:00
State: open

Here is an example:

```php

$objFile = new File('tl_files/some_file.jpg');

// next, let's rename this file
$objFile->renameTo(str_replace('.jpg', '_RENAMED.jpg', $objFile->value));

// physicaly file was renamed to tl_files/some_file_RENAMED.jpg
// but if to do this:

echo $objFile->value;
// we will see: tl_files/some_file.jpg
// but expected to see renamed filename
```

This happens because when we first call `$objFile->value` the value is cached in object as `$this->arrCache['value']` and after we call `$objFile->renameTo()` it's only change protected `$strFile` value, but not cached value `$this->arrCache['value']`.

The same is true for `$objFile->basename` and `$objFile->filename` values.