I'm using the get_browser()
function, and I installed the latest php_browscap.ini
file from http://tempdownloads.browserscap.com/, updated my php.ini file to reflect the new location.
Here's my simple code I've gleaned from PHP's site:
<?php
echo $_SERVER['HTTP_USER_AGENT'];
echo "<br>";
echo "<br>";
$browser = get_browser(null, true);
print_r($browser);
?>
And the result is this:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0
Array ( [browser_name_regex] => �^mozilla/5\.0 \(.*windows nt 6\.1.*wow64.*\).*gecko/.*firefox/21\..*$� [browser_name_pattern] => Mozilla/5.0 (*Windows NT 6.1*WOW64*)*Gecko/*Firefox/21.* [parent] => Firefox 21.0 [platform] => Win7 [platform_version] => 6.1 [win32] => [win64] => 1 [comment] => Firefox 21.0 [browser] => Firefox [version] => 21.0 [majorver] => 21 [minorver] => 0 [beta] => 1 [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [javascript] => 1 [javaapplets] => 1 [cssversion] => 3 [alpha] => [win16] => [backgroundsounds] => [vbscript] => [activexcontrols] => [ismobiledevice] => [issyndicationreader] => [crawler] => [aolversion] => 0 )
I'm seeing a weird character in the [browser_name_regex] section.
Is that expected?
Also, I
@Stano, thanks for the explanation. Based on your answer and the information found at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=612364 which explains the bug more throughly, i've created some lines of code which solves the problem.
The same question has been asked at Getting illegal characters in get_browser() method run in php
I've posted my answer both here and there.
Code:
Although it's not expected, but it's allowed. My output from the
get_browser()
function was[browser_name_regex] => §^.*$§
. It just has two paragraphs instead of exerted slashes/^.*$/
.Explanation: