php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19393 get_browser() returns an empty array
Submitted: 2002-09-13 11:40 UTC Modified: 2002-10-08 21:47 UTC
Votes:5
Avg. Score:4.2 ± 1.0
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:1 (20.0%)
From: philippe at pyf-labs dot com Assigned:
Status: No Feedback Package: PHP options/info functions
PHP Version: 4.2.1 OS: Suse Linux 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 20 = ?
Subscribe to this entry?

 
 [2002-09-13 11:40 UTC] philippe at pyf-labs dot com
Hi Gurus !

(Running PHP 4.2.1 with a Apache/1.3.26 server installed from the Suse Linux 8.0 disks).

Using the following script found in the documentation :

<?php
function list_array ($array) {
    while (list ($key, $value) = each ($array)) {
    $str .= "<b>$key:</b> $value<br>\n";
    }
    return $str;
}
echo "$HTTP_USER_AGENT<hr>\n";
$browser = get_browser();
echo list_array ((array) $browser);
?>

I only get the $HTTP_USER_AGENT value and nothing more, the get_browser() function returns FALSE.

My php.ini file point to the browscap.ini file. This is confirmed by executing phpinfo()

Looking at the bug history I saw that this seems to be a recurent problem. Anything you can do ?

Thanks !

Philippe

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-17 22:12 UTC] iliaa@php.net
Check your Apache's error log for error messages pertaining to PHP's ability to parse browscap.ini, these errors would only occur on Apache start.
Since php's browscap.ini parser will stop parsing the file if it encounters an error, the effect is the same as not having a browscap.ini in the first place.
The solution in this case would be to either fix the lines PHP's parser complains about or remove them from the file all together.
 [2002-10-08 21:47 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2007-10-12 14:21 UTC] brett dot jr dot alton at gmail dot com
I'm now running this script:

<?php
echo $_SERVER['HTTP_USER_AGENT'] . "<br /><br />";
$browser = get_browser(null,true);
print_r($browser);
?> 

and it only returns:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20071008 Ubuntu/7.10 (gutsy) Firefox/2.0.0.6

with no array.

My server is running PHP 5.2.1, Apache 2.2.3 and my browscap.ini file is in '/etc/php5/apache2/extra/browscap.ini'. The file I am using is from http://browsers.garykeith.com/downloads.asp called 'php_browscap.ini'.

Yes, I renamed the file to 'browscap.ini' in the '/etc/php5/apache2/php.ini' file.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC