# [PHP-CVS] cvs: php4(PHP_4_3) / NEWS

- Thread: https://externals.io/message/1579
- Original archive: https://news-web.php.net/php.internals/1579
- Started by Uwe Schindler on 2003-05-16T16:28:17+00:00
- Messages: 5
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1579 — Uwe Schindler — 2003-05-16T16:28:17+00:00

URL: https://externals.io/message/1579#1579

I told that a few days before... You should replace in browscap.ini the 
fopen by a zend_file_handle with type FD or FILENAME. I changed that and 
have a replacement for browscap.ini but I cannot submit it due to 
insufficient karma.

In the patch is also fixed one bug in the regular expression generated.

But Sasha should change the code, too.

At 18:08 16.05.2003 +0300, you wrote:

>     That lexer stuff seems to have broken the browscap stuff..
>     See bug #23657
>
>     --Jani
>
>
>
>--
>
>

-----
Uwe Schindler
Addr 1: Bamberger Str. 24a, D-96049 Bamberg
Addr 2: Drausnickstr. 153, D-91052 Erlangen
http://www.thetaphi.de - http:///www.schindlers-software.de
eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company)
Tel./Fax: +49 700 PCLATEIN (+49 700 72528346)

Schindlers Software - Home of Schindlers PC-LATEIN 3.10
DIE Software zum Lateinlernen!

---

## #1594 — Jay Smith — 2003-05-16T17:57:48+00:00

URL: https://externals.io/message/1579#1594 · In reply to: #1579

Since you're still doing some browscap stuff, feel like testing a patch? I
noticed today that some of the browsers reported by `get_browser()` are still
pretty inaccurate. (Mozilla  for instance is especially bad -- I'm getting
it reported as "Netscape 5", despite the fact that it's clearly Mozilla
1.2.1.)

This patch (against HEAD) makes the browser_reg_compare() function a bit
more thourough in it's search for a browser. It doesn't bail out on the
first match it finds, for instance, as there are usually better matches
further down in the browscap.ini file.

I've run it against as many user agent strings as I could find, and it's
reporting things much better now. (Recognizing Mozilla, properly reporting
Win98 instead of WinME in certain cases, finding the .NET CLR, finally
reporting SunOS instead of linux, etc.)

It's slightly slower because of an extra hash lookup, but I think the slight
slow down is worth the extra precision. I can incorporate any further fixes
you have, if you'd like.

J


Uwe Schindler wrote:

> I told that a few days before... You should replace in browscap.ini the
> fopen by a zend_file_handle with type FD or FILENAME. I changed that and
> have a replacement for browscap.ini but I cannot submit it due to
> insufficient karma.
> 
> In the patch is also fixed one bug in the regular expression generated.
> 
> But Sasha should change the code, too.

---

## #1599 — Uwe Schindler — 2003-05-16T18:24:14+00:00

URL: https://externals.io/message/1579#1599 · In reply to: #1579

I think the most important thing is to match for the WHOLE String, so the 
pattern must contain ^....$. This is fixed in PHP5 but jay did not want to 
put it into 4.3.2
But adding you code looks pretty good. Longer strings that match are more 
accurate.

And by the way: using the browscap.c from the PHP5 tree at this time does 
not lead to the segmentation fault in bug #23657. Compiling with the PHP 
4.3.2RC3 also segfaults on NSAPI.

Uwe

At 13:57 16.05.2003 -0400, you wrote:

>Since you're still doing some browscap stuff, feel like testing a patch? I
>noticed today that some of the browsers reported by `get_browser()` are still
>pretty inaccurate. (Mozilla  for instance is especially bad -- I'm getting
>it reported as "Netscape 5", despite the fact that it's clearly Mozilla
>1.2.1.)
>
>This patch (against HEAD) makes the browser_reg_compare() function a bit
>more thourough in it's search for a browser. It doesn't bail out on the
>first match it finds, for instance, as there are usually better matches
>further down in the browscap.ini file.
>
>I've run it against as many user agent strings as I could find, and it's
>reporting things much better now. (Recognizing Mozilla, properly reporting
>Win98 instead of WinME in certain cases, finding the .NET CLR, finally
>reporting SunOS instead of linux, etc.)
>
>It's slightly slower because of an extra hash lookup, but I think the slight
>slow down is worth the extra precision. I can incorporate any further fixes
>you have, if you'd like.
>
>J
>
>
>Uwe Schindler wrote:
>
> > […]
>
>--
>
>

-----
Uwe Schindler
Addr 1: Bamberger Str. 24a, D-96049 Bamberg
Addr 2: Drausnickstr. 153, D-91052 Erlangen
http://www.thetaphi.de - http:///www.schindlers-software.de
eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company)
Tel./Fax: +49 700 PCLATEIN (+49 700 72528346)

Schindlers Software - Home of Schindlers PC-LATEIN 3.10
DIE Software zum Lateinlernen!

---

## #1603 — Jay Smith — 2003-05-16T18:33:52+00:00

URL: https://externals.io/message/1579#1603 · In reply to: #1599

I would have liked to have committed to PHP_4_3, but 4.3.2RC1 had already
rolled, and new features shouldn't have been added. Maybe for 4.3.3. 

I haven't seen the NSAPI problem yet, but I'll try it today. The segfault
should be fixed (Ilia, I believe?) in 4_3, I think.

J


Uwe Schindler wrote:

> I think the most important thing is to match for the WHOLE String, so the
> pattern must contain ^....$. This is fixed in PHP5 but jay did not want to
> put it into 4.3.2
> But adding you code looks pretty good. Longer strings that match are more
> accurate.
> 
> And by the way: using the browscap.c from the PHP5 tree at this time does
> not lead to the segmentation fault in bug #23657. Compiling with the PHP
> 4.3.2RC3 also segfaults on NSAPI.
> 
> Uwe

---

## #1607 — Uwe Schindler — 2003-05-16T18:41:15+00:00

URL: https://externals.io/message/1579#1607 · In reply to: #1599

There is no special problem in NSAPI. It only confimed the bug and said 
that with the patch of you (I need it on my webserver because browscap does 
NOT work correct even in 4.3.2) the problem disappeared, too.

So for my point of view the use of the PHP5 source of browscap.c was 
better. And if you do not want to use it in 4.3.2 we should add the $ and ^ 
to the regex created.

At 14:33 16.05.2003 -0400, you wrote:

>I would have liked to have committed to PHP_4_3, but 4.3.2RC1 had already
>rolled, and new features shouldn't have been added. Maybe for 4.3.3.
>
>I haven't seen the NSAPI problem yet, but I'll try it today. The segfault
>should be fixed (Ilia, I believe?) in 4_3, I think.
>
>J

-----
Uwe Schindler
Addr 1: Bamberger Str. 24a, D-96049 Bamberg
Addr 2: Drausnickstr. 153, D-91052 Erlangen
http://www.thetaphi.de - http:///www.schindlers-software.de
eMails: uwe@thetaphi.de (private); info@schindlers-software.de (company)
Tel./Fax: +49 700 PCLATEIN (+49 700 72528346)

Schindlers Software - Home of Schindlers PC-LATEIN 3.10
DIE Software zum Lateinlernen!
