php.net |  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
Votes:7
Avg. Score:4.3 ± 0.7
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:46 UTC] jani@php.net
-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] kalle@php.net
-Status: Open +Status: Analyzed
 [2017-08-23 00:31 UTC] kalle@php.net
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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC