Menu

#4 Patch for phpSniff on PHP5

open
nobody
None
5
2005-08-18
2005-08-18
No

Hello,
I found a bug that I fixed that I saw in my logs
when I upgraded to php5. I was using pLog when I found
the problem.

Here is the diff:

---
plog/branches/plog-1.0.2/class/net/http/phpsniff/phpSniff.class.php
2005-08-14 16:46:22 UTC (rev 2410)
+++
plog/branches/plog-1.0.2/class/net/http/phpsniff/phpSniff.class.php
2005-08-18 06:16:20 UTC (rev 2411)
@@ -191,8 +191,8 @@
// 20020425 :: besfred
if(empty($UA)) $UA = getenv('HTTP_USER_AGENT');
if(empty($UA)) {
- $pv = explode(".", PHP_VERSION);
- $UA = ( $pv[0] > 3 && $pv[1] > 0 ) ?
$_SERVER['HTTP_USER_AGENT'] :
$HTTP_SERVER_VARS['HTTP_USER_AGENT'];
+ global $HTTP_SERVER_VARS;
+ $UA = ( phpversion() >= "4.1.0" ) ?
$_SERVER['HTTP_USER_AGENT'] :
$HTTP_SERVER_VARS['HTTP_USER_AGENT'];
}
// 20020910 :: rraymond
if(empty($UA)) return false;

The two problem were:
1) $_SERVER is only valid with versions of php >= 4.1.0
2) Before the $HTTP_SERVER_VARS variable is used, it
needs to be declared a global

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.