Hello!
I suppose the function get_browser() doesn't work correctly.
The following example (out of the PHP documentation) delivers no valid result:
<?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);
?>
Just as the first example, this one doesnt' work either:
<?
$ua = get_browser ();
echo "Browser: $ua->browser";
?>
It would be very nice if someone told me what I'm doing wrong!
(PHP Version: 4.2.2)
greets
Jens
problem with get_browser()
Moderator: General Moderators
does the browscap parameter in your php.in point to a valid browscap.ini?
what doesprint? is there a corresponding entry in browscap.ini?
what does
Code: Select all
<?php echo $HTTP_SERVER_VARS['HTTP_USER_AGENT']; ?>then tryand/orif there is no browscap.ini you might ask the administrator/provider or install one for yourself and set the parameter within your scriptbefore calling get_browser()
Code: Select all
<?php phpinfo(); ?>Code: Select all
<?php
$bc = ini_get('browscap');
if ($bc !== '')
{
header('Content-type: text/plain');
readfile($bc);
}
else
echo 'no browscap.ini';
?>Code: Select all
<?php
init_set('browscap', $pathToFile);
?>Hello volka!
You were right, the problem was the missing 'browscap' entry in php.ini.
I contact my Webhoster and he told me that they do not provide this feature because it is not free of bugs (http://bugs.php.net/bug.php?id=19649)
Thank you anyway...
JEns
You were right, the problem was the missing 'browscap' entry in php.ini.
I contact my Webhoster and he told me that they do not provide this feature because it is not free of bugs (http://bugs.php.net/bug.php?id=19649)
Thank you anyway...
JEns
I can't reproduce any of these errors on PHP 4.3.1 (neither w2k, nor gentoo-linux)Status: Closed
Category: Reproducible crash
Version: 4.3.0-dev
...
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot.