-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CachedReader fails if Reflection class is eval'd code #186
Comments
I guess this could be avoided if the file existence was checked? eg return max(array_merge(
[file_exists($filename) ? filemtime($filename) : 0],
array_map([$this, 'getTraitLastModificationTime'], $class->getTraits()),
array_map([$this, 'getLastModification'], $class->getInterfaces()),
$parent ? [$this->getLastModification($parent)] : []
)); What do you think? |
It should rather throw a more explicative exception, explaining that the
annotations cannot be scanned.
On 21 Mar 2018 18:34, "Jake Bishop" <[email protected]> wrote:
I guess this could be avoided if the file existence was checked? eg
return max(array_merge( [file_exists($filename) ?
filemtime($filename) : 0], array_map([$this,
'getTraitLastModificationTime'], $class->getTraits()),
array_map([$this, 'getLastModification'], $class->getInterfaces()),
$parent ? [$this->getLastModification($parent)] : []
));
What do you think?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#186 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakARpkNYocy-vmil-sUZXzXhrD4XUks5tgo8OgaJpZM4S06hd>
.
|
Possibly. But then what should handle this exception? It would just bubble up (like the current error) and something unrelated. Technically it’s not a problem because it’s just signalling whether the cash is fresh or not. The change suggested above seems to fix it. It might always report the cache is old for eval’d code, but I would say that’s an edge case? |
Let me re-formulate a few questions to clear if this should be an exception
or not:
1. Are the normal readers capable of reading annotations from this class?
2. Fid this class previously exist on disk or is it always purely
evaluated?
3. Is the cached reader the only failing endpoint?
If the CachedReader is really the only failing component here, and the file
is never touched (always eval'd), then we must assume that the file mtime
is somewhere in the future (not yet written to disk), which would let the
cache be completely skipped. No exception in that scenario.
…On 21 Mar 2018 23:08, "Jake Bishop" ***@***.***> wrote:
Possibly. But then what should handle this exception? It would just bubble
up (like the current error) and something unrelated. Technically it’s not a
problem because it’s just signalling whether the cash is fresh or not. The
change suggested above seems to fix it. It might *always* report the
cache is old for eval’d code, but I would say that’s an edge case?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#186 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJakJ4_W2lGaGRso2TAhd0PvhylESVaks5tgs94gaJpZM4S06hd>
.
|
This makes a bit of a question of what to do about the cache for this eval'd code. If it is in the future, then the cache will always be dirty and re-written? Would this be a performance problem? |
Yes, but since we can't determine the age of the file, then all caching should be skipped. |
i'm facing this issue too when running local tests (everything works fine on remote CI) :
is it a |
It appears to be the CachedReader.php on @VaN-dev Could you try to to replace the section in the comment #186 (comment) to see if it helps? If so, then I could PR a change. However... It looks appears that the CachedReader.php no longer exists in the 2.0 branch. @Ocramius would this problem just "go away" with 2.0? Where did the caching go 🙂? |
@yakobe yes, wrapping with |
ok. @Ocramius / other contributors... does it make sense to PR a change? If so, to the v1.8 or v1.7 branch? Or is 2.0 planned soon and solves it anyway? |
/summon @Ocramius |
I've described this recently in sebastianbergmann/phpunit#3606 (comment) This is not just a problem with caching, but with annotation parsing in general: you just happen to be stuck with caching, because a cache hit/miss check already fails.
|
Hello,
Wrapping to I have the error on server:
in Error happens when this string is called: src/Application/Document/Application.php:
src/Application/Document/AppGroup.php:
If the document
|
I also started hitting this problem today for some yet unknown reason. What causes |
Update |
When ReflectionClass->getFileName() returns a filename with eval()'d in it, filemtime emits a warning which is thrown as an Error Exception in Symfony by default. - Related to this issue in doctrineannotations: doctrine/annotations#186
Hallo guys, When is the new code going to be provided to us? I have v1.13.3 of doctrine/annotations |
@Univalgo when this comment is addressed I suppose: #436 (comment) |
If the ReflectionClass is eva'd code, then it crashes when checking when the cache is fresh. It tries to CachedReader::getLastModification of the eval'd code and results in:
Warning:` filemtime(): stat failed for /app/src/MyCode/EntityGenerator.php(36) : eval()'d code
The text was updated successfully, but these errors were encountered: