Bug #54446
Cache filebackend 'include_once'
Status: | New | Start date: | 2013-12-16 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | Cache | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No | Affected Flow version: | Flow 2.0.0 |
Description
The 'SimpleFileBackend' in the caching framework is used by the autoloader to check whether a file can be included. It uses 'include_once' to check if the file can be loaded.
I'm now running in some troubles related to issue #46689, the autoloader tries to load classes like 'Annotation', or 'api' which fail the first time. But the autoloader seems to be called twice due to multiple calls to 'AnnotationRegistry::registerLoader' in bootstrap/ReflectionService registering the autoloader multiple times.
According to the documentation a second call to 'include_once' always returns TRUE, so the autoloader simply returns TRUE when trying to load the file the second time even if it does not exist.
Suggestions:
- Check if the file exists before doing an 'include_once'
- Move the 'ignoredClassNames' check above 'classesCache->requireOnce' in 'loadClass' method (making sure that files like 'api.php', 'param.php' are not loaded)
- Prevent the Flow class loader from being registered twice using 'AnnotationRegistry::registerLoader' (performance, see Bootstrap and ReflectionService->initialize)