dg / bypass-finals

Removes `final` and `readonly` keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit or Mockery.
Other
487 stars 30 forks source link

What happens when using an opcode cache? #12

Closed ayg closed 4 years ago

ayg commented 5 years ago

I don't know if this is really an "issue" so much as a question. But it seems worth documenting either way, so I'll claim it's a documentation request.

How does this interact with opcode caches like APC? If on one request a PHP file gets cached with finals not removed, and then another request comes along and tries to load the file with finals removed, is the parsed file going to get served from cache with finals still in it? I.e., you'll get files randomly with or without final depending on which one got cached? Or is this avoided somehow?

dg commented 5 years ago

It seems it works even when the file is in cache, but I only tried it with OPcache and it is possible that in other systems and versions it may behave differently.