php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28920 Problem with PHP's get_browser()
Submitted: 2004-06-25 13:50 UTC Modified: 2004-06-28 17:22 UTC
From: klaus_kuehne at t-online dot de Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.6 OS: Win 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: klaus_kuehne at t-online dot de
New email:
PHP Version: OS:

 

 [2004-06-25 13:50 UTC] klaus_kuehne at t-online dot de
Description:
------------
Hello,

following happens in PHP 4.3.6:
(1)
$browser = get_browser();
foreach ($browser as $key => $val) print "$key = $val, ";
delivers: ..., cookies = 1, ... (correctly)
(2)
$browser = get_browser();
print $browser["cookies"];
delivers NULL !!!! 
(3)
$browser = get_browser();
$arr = array();
foreach ($browser as $key => $val) $arr[$key] = $val;
print $arr["cookies"];
delivers 1.

I don't understand the NULL-result of (2).

Greetings Klaus K?hne


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-28 07:12 UTC] klaus_kuehne at t-online dot de
Sorry, there was no reason for my bug report: get_browser() returns an object, no array. But here is a little bug in the FOREACH-documentation:

"foreach works only on arrays, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable."
We ca see, it works on onjects, too.

Klaus K?hne
 [2004-06-28 17:22 UTC] jay@php.net
. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 23:01:33 2025 UTC