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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 10:01:31 2024 UTC