Req #20914 [PATCH]: Allow changing browscap.ini in runtime for get_browser() function

From: Date: Mon, 19 Jul 2021 11:17:03 +0000
Subject: Req #20914 [PATCH]: Allow changing browscap.ini in runtime for get_browser() function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235170@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=20914&edit=1 ID: 20914 Patch added by: sample@email.tst Reported by: nzdarktrojan at hotmail dot com Summary: Allow changing browscap.ini in runtime for get_browser() function Status: Analyzed Type: Feature/Change Request Package: PHP options/info functions Operating System: * PHP Version: * Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: kXvrbKwH Revision: 1626693423 URL: https://bugs.php.net/patch-display.php?bug=20914&patch=kXvrbKwH&revision=1626693423 Previous Comments: ------------------------------------------------------------------------ [2021-07-19 11:16:33] sample at email dot tst The following patch has been added/updated: Patch Name: kXvrbKwH Revision: 1626693393 URL: https://bugs.php.net/patch-display.php?bug=20914&patch=kXvrbKwH&revision=1626693393 ------------------------------------------------------------------------ [2017-08-23 00:31:52] 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 ------------------------------------------------------------------------ [2002-12-09 19:28:33] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=20914&edit=1

« previous php.bugs (#235170) next »