php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27839 Similar problems to #27291 when using parse_ini_file() NOT get_browser()
Submitted: 2004-04-02 10:10 UTC Modified: 2004-04-02 15:30 UTC
From: little_miss_goth at hotmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.4 OS: Linux(/others?)
Private report: No CVE-ID: None
 [2004-04-02 10:10 UTC] little_miss_goth at hotmail dot com
Description:
------------
I'm using the parse_ini_file() function as the basis for a reimplementation of get_browser(). I'm having to process browscap.ini without using the get_browser() function as the hosting people I'm using won't set the browscap path in php.ini. Until fairly recently this was working fine.

I'm receiving parse errors on the browscap.ini against the "browser=Yahoo! Slurp" line, the same as Gary Keith mentions in one of his comments in Bug #27291 [get_browser matches browscap.ini patterns incorrectly].

The browscap.ini section that causes this reads:
  [Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)]
  parent=Yahoo
  browser=Yahoo! Slurp

From the ChangeLog and #27291's comment listing, issues with get_browser() have apparently been fixed in 4.3.5.

However, I'm not using get_browser(), and so I was wondering if the fix implemented for that will also remedy the parse_ini_file() issue? For example, does get_browser() call parse_ini_file() [or does the engine do something along those lines]?

Oh, BTW, editting the browscap.ini manually so that "browser=Yahoo Slurp" rather than the sourced "browser=Yahoo! Slurp" causes everything to function properly.

The hosting people are running under PHP 4.3.4 at the moment.

Reproduce code:
---------------
function browserCapabilities($userAgent, $browscapLocation) {

  [..Some initialisation if variables..]

  print "      Processing: $userAgent\n";
  $this->browscapFile = parse_ini_file ($browscapLocation, TRUE);

  [..Some array processing..]

  [.. Print statements for browser capabilities..]

}

Expected result:
----------------
      Processing: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; (R1 1.3); .NET CLR 1.1.4322)
      Browser supports JavaScript: Yes
      Browser supports CSS Level 2: Yes
      Browser is text-only: No
      Browser is MSIE: Yes
      Browser detection complete. Browser type set to: msie.


Actual result:
--------------
      Processing: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; (R1 1.3); .NET CLR 1.1.4322)
<br />
<b>Warning</b>:  Error parsing /nfs/home/air-cr2/public_html/anneharris/includes/browscap.ini on line 521
 in <b>/nfs/home/air-cr2/public_html/includes/processBrowscap.hpi</b> on line <b>164</b><br />
      Browser supports JavaScript: No
      Browser supports CSS Level 2: No
      Browser is text-only: No
      Browser is MSIE: No
      Browser detection complete. Browser type set to: incapable.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-02 15:30 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of bug #27372. 
 
In both instances internal ini parsing mechanism is being 
used. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 18:01:28 2024 UTC