0

I had other issues with avatars, but a fresh install of 3.1.1 seemed to resolve that. Now, when I went into the member profile on a fresh install, it displayed proper the first time. When I went back in the second time, I got this error:

Exception Caught

Attempting to access file outside of directory.
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Service\File\Directory.php:28

Stack Trace: hide details

#0     
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Library\Filesystem\Filesystem.php(306): EllisLab\ExpressionEngine\Service\File\Directory->normalize('facebook_1.png')

#1 
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Controller\Members\Profile\Settings.php(120): EllisLab\ExpressionEngine\Library\Filesystem\Filesystem->exists('facebook_1.png')

#2
[internal function]: EllisLab\ExpressionEngine\Controller\Members\Profile\Settings->index()

#3 
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Core\Core.php(191): call_user_func_array(Array, Array)

#4     
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Core\Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)

#5 
C:\GIT\Production\stkhomes.net\system\ee\EllisLab\ExpressionEngine\Boot\boot.php(138): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))

#6
C:\GIT\Production\stkhomes.net\public_html\admin\index.php(143): require_once('C:\\GIT\\Producti...')

#6
C:\GIT\Production\stkhomes.net\public_html\admin\index.php(143): require_once('C:\\GIT\\Producti...')

This happens on both production server and development server.

PHP Version 5.3.29 EE Version 3.1.1


*** UPDATE

It is happening here:

protected function normalize($path)
    {
        $path = $this->root.'/'.$path;

        if (strpos($path, '..') !== 0)
        {
            throw new FilesystemException('Attempting to access file outside of directory.');
        }

        return $path;
    }

If I echo out the path, it is : C:/GIT/Production/stkhomes.net/public_html/images/avatars/facebook_1.png

The statement should equate to False thus returning the variable $path.

If I comment out this section:

if (strpos($path, '..') !== 0)
            {
                throw new FilesystemException('Attempting to access file outside of directory.');
            }

The page loads fine.

1 Answer 1

0

This code appears to be expecting $this->root to be a relative file path (think something like ../my_web_root/), but is instead getting a full server path (C:/GIT/production/etc).

Check all of your file upload preferences and path settings for your installations are correct. If you're 100% sure your paths are correct, this sounds like a possible bug, possibly connected to Windows file paths. I would recommend contacting EllisLab at [email protected].

4
  • Where are the file path settings in 3? For whatever reason, 3 has thrown me for a loop.
    – W3bGuy
    Commented Jan 25, 2016 at 16:12
  • Even the production server has the same issue (Non-Windows)... Exception Caught Attempting to access file outside of directory. /home/stkhomes/system/ee/EllisLab/ExpressionEngine/Service/File/Directory.php:28
    – W3bGuy
    Commented Jan 25, 2016 at 16:16
  • Sounding even slightly more bug-like. Investigate the code that generates that method's parent class $root variable.
    – jrothafer
    Commented Jan 25, 2016 at 16:59
  • The code just uses the PHP realpath() which, in this case, generates /home/stkhomes/public_html/images/avatars/ for the root. Then rebuilds the full path from the root by appending '/' and the passed string. In this sample, I chose the bunny, so: /home/stkhomes/public_html/images/avatars/zombie_bunny.png
    – W3bGuy
    Commented Jan 25, 2016 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.