Closed flowip closed 8 years ago
In my opinion it's a bug, not enhancement or feature.
Besides opcache there are XCache, APC and more PHP opcode cachers. I don't think it's in the framework scope to invalidate their data.
I think it should be added.
For which cache backends?
just opcache because it is built into php. APC is kind of outdated. XCache does not have such a function as far as I see.
OpCache is built into PHP 5.5+ but for PHP 5.4 it's common to use APC. Since we're supporting 5.4+ for 2.0, I'm not sure it's a good idea to have code for OpCache only.
We've agreed to support only 5.6+ since 2.1. I don't think it's a problem
then lets add apc for 2.0.x too. http://php.net/manual/en/function.apc-delete-file.php
OK.
Resolved by commit b7b8348c732065aa2c41f0775ed3450afbe9097e
If you use
PhpManager
andOPcache
is enabled andopcache.revalidate_freq
is not zero (2 seconds by default), then after assigning a user to a role there is gonna be 2 seconds interval whenPhpManager
will return old roles for a user. But only in next user requests, because assignments not only stored inassignments.php
file, but also in$this->assignments
array.So, if you assign new role to a user on login and then redirect him to some page, then this page will not know that the user is assigned to a new role, because old (cached)
assignments.php
file will be returned.My workaround. I call
opcache_invalidate($auth->assignmentFile)
after assigning new roles to users.