Project

General

Profile

Actions

Bug #64508

closed

Class cache corruption in chroot environment

Added by Martin Helmich almost 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2015-01-26
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

Summary

This issue occurs in the rare edge case when the TYPO3 cli dispatcher is called in a chroot environment and the site is delivered via a non-chrooted web server.

In this case, all classes in the class cache will be stored with PATH_typo3 as base path, except the TYPO3\Flow classes in the core extension. These are based on the __DIR__ constant, which according to [1] resolves symlinks that generates directory paths that are invalid outside of the chroot environment.

Example

Consider the following chroot environment directory layout:

<root>
\_ html
|   \_ typo3
|       \_ index.php
|       \_ ...
\_ home
    \_ www
        \_ /p123456 -> ../../

Note the backwards-recursive symlink that is required for processes inside the chroot (like a PHP process called from the CLI) to be able to resolve non-chrooted paths.

Now consider that the CLI dispatcher is called with the absolute path:

$ php /home/www/p123456/html/typo3/typo3/cli_dispatch.phpsh ...

TYPO3 will now build the PATH_site constant from the path of the called file, i.e. /home/www/p123456/html/typo3. This is a valid path both within the chroot environment (thanks to the backward symlink) and system-wide. This path is also used in the cache_classes cache that might be built during the CLI call.

This, however, is not the case for the TYPO3 Flow classes that are included in the core extension. In the core extension's ext_autoload.php, the magic __DIR__ constant is used as base path for all TYPO3 Flow class files. Since these paths are absolute, they are used in the cache_classes cache.

However, the __DIR__ constant resolves symlinks, and in the chroot environment will resolve to /html/typo3/... instead of /home/www/p123456/html/typo3/.... This results in invalid cache entries when the cache_classes cache is accessed in a non-chrooted context.

Suggested solution

Use PATH_typo3 as base path for the TYPO3 Flow classes. Change request in Gerrit will follow shortly.

[1] http://php.net/manual/en/language.constants.predefined.php

Actions #1

Updated by Gerrit Code Review almost 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36272

Actions #2

Updated by Gerrit Code Review almost 10 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36301

Actions #3

Updated by Martin Helmich almost 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF