You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.
The caching mechanism has a built-in version check for all the source parser files.
Browscap version is checked using filesize(ini_get('browscap')), as it is a good enough approximation of the file contents.
The problem is that when you're running a multi server configuration and each server uses its own browscap file, not the one supplied with this class (available in imports/browcap.ini), the files may differ on each server. If that happens and you have a cache that is common for all the servers then the cached UserAgentInfo objects will constantly be invalidated and regenerated, slowing down the servers, as parsing ua strings is a costly operation.
This is not a bug, the class actually behaves correctly, because the parsing results using different browscap version will differ. However, it is an issue, because it's not obvious that this can happen.
The proper way to fix it, without changing anything in UserAgentInfo project is to force your admins to keep the browscap files updated on all the servers, or to point the servers to UserAgentInfo internal browscap.ini file.
However, since that requires changes on the servers, it may not always be an option, it may take long time to change, and so on and so forth.
This will stop being an issue when I stop relying on browscap php.ini configuration and the PHP module for browscap. Using this module is not a good idea for other reasons (such as: required server configuration and parsing speed), so this issue is another important reason to start using browscap fully in PHP, as it is shown in https://github.com/GaretJax/phpbrowscap/
The text was updated successfully, but these errors were encountered:
Temporarily fixed in version 1.2 by replacing the computed browscap version with a constant string. This means that if the browscap changes, the class will not see that, but seems like a good trade off for regenerating constantly.
The caching mechanism has a built-in version check for all the source parser files.
Browscap version is checked using
filesize(ini_get('browscap'))
, as it is a good enough approximation of the file contents.The problem is that when you're running a multi server configuration and each server uses its own browscap file, not the one supplied with this class (available in
imports/browcap.ini
), the files may differ on each server. If that happens and you have a cache that is common for all the servers then the cachedUserAgentInfo
objects will constantly be invalidated and regenerated, slowing down the servers, as parsing ua strings is a costly operation.This is not a bug, the class actually behaves correctly, because the parsing results using different browscap version will differ. However, it is an issue, because it's not obvious that this can happen.
The proper way to fix it, without changing anything in
UserAgentInfo
project is to force your admins to keep the browscap files updated on all the servers, or to point the servers toUserAgentInfo
internalbrowscap.ini
file.However, since that requires changes on the servers, it may not always be an option, it may take long time to change, and so on and so forth.
This will stop being an issue when I stop relying on browscap
php.ini
configuration and the PHP module for browscap. Using this module is not a good idea for other reasons (such as: required server configuration and parsing speed), so this issue is another important reason to start using browscap fully in PHP, as it is shown in https://github.com/GaretJax/phpbrowscap/The text was updated successfully, but these errors were encountered: