|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20914 Allow changing browscap.ini in runtime for get_browser() function
Submitted: 2002-12-09 19:28 UTC Modified: 2017-08-23 00:31 UTC
Avg. Score:4.1 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:2 (33.3%)
From: nzdarktrojan at hotmail dot com Assigned:
Status: Analyzed Package: PHP options/info functions
PHP Version: * OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nzdarktrojan at hotmail dot com
New email:
PHP Version: OS:


 [2002-12-09 19:28 UTC] nzdarktrojan at hotmail dot com
The get_browser () function currently can only use a single browscap.ini, as specified in php.ini. Therefore (to my knowledge) if the browscap.ini is changed, the server (I'm using Apache) must be restarted before the changes filter through to PHP. In my situation (and probably many others), I don't own or have rights to the server, and the owners are unwilling to restart the server (I'm developing a customized browscap, and I make changes frequently).

What I suggest (I don't have enough knowledge of C, or I'd do it myself) is overloading the get browser function,
from: object get_browser ([string user_agent])
to: object get_browser ([string user_agent], [string browscap_file])

When the function is called, it loads the browscap_file to memory and uses that instead of the global file. This would also be useful where multiple sites are hosted on the same server, but the sites wish to use different browscap files.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:46 UTC]
-Summary: Extending get_browser () function +Summary: Allow changing browscap.ini in runtime for get_browser() function -Package: Feature/Change Request +Package: PHP options/info functions -Operating System: All +Operating System: * -PHP Version: 4.2.3 +PHP Version: *
 [2017-08-23 00:31 UTC]
-Status: Open +Status: Analyzed
 [2017-08-23 00:31 UTC]
The reason why is that PHP will load the browscap file into memory at initialization so calls to get_browser() will be faster if called multiple times, tho I suppose it could make sense to allow specific browscap files to be loaded if so desired. But all in all, I think it could be re-worked to allow a browscap in php.ini to be PHP_INI_USER or PHP_INI_ALL but I'm not sure how much of a value that is today, 15 years after the report was created
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jun 13 02:01:24 2021 UTC