php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74501 get_browser() generates incorrect error
Submitted: 2017-04-26 16:53 UTC Modified: 2017-05-02 11:43 UTC
From: dpatterson at dplhenterprises dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 7.0.18 OS: Ubuntu 16.0.4
Private report: No CVE-ID: None
 [2017-04-26 16:53 UTC] dpatterson at dplhenterprises dot com
Description:
------------
The get_browser() function can generate a "Warning: get_browser(): browscap ini directive not set" error when the browscap ini directive *is* set.

The browscap file is read at run time. This means that the web server must be able to read it.

If the file's protection or ownership prevents the web server from reading it (e.g., if it's owned by root), get_browser() will generate the "Warning: get_browser(): browscap ini directive not set" error instead of reporting that the file can't be read.

Test script:
---------------
/*
 * In php.ini:
 *     browscap = /etc/php/7.0/apache2/lite_php_browscap.ini
 * lite_php_browscap.ini is owned by root
 */
$bData = get_browser(); // Results in incorrect error.

Expected result:
----------------
$bData contains an object describing the browser.

Actual result:
--------------
"Warning: get_browser(): browscap ini directive not set" error.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-02 11:43 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2017-05-02 11:43 UTC] ab@php.net
Thanks for the report. Please check the error log. The browcap.ini is checked with streams, so there will be sure a warning about an unsuccessful read or alike.

Thanks.
 [2017-05-02 12:08 UTC] spam2 at rhsoft dot net
> Please check the error log. so there will be sure a warning 
> about an unsuccessful read or alike

how does that change the fact that "Warning: get_browser(): browscap ini directive not set" is wrong which is all that bugreport is about?
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Dec 03 22:05:53 2022 UTC