From:             [EMAIL PROTECTED]
Operating system: Solaris 9
PHP version:      4.3.4RC1
PHP Bug Type:     Unknown/Other Function
Bug description:  PHP Fatal error: Nesting level too deep - recursive dependency?

Description:
------------
The following error occurs sometimes on the ext/standard function
get_browser():
[20/Oct/2003:08:54:59] info (13034):  for host p5084725C.dip.t-dialin.net
trying to GET /index.php, php4_execute reports: PHP Fatal error: Nesting
level too deep - recursive dependency? in
/pangaea/htdocs/www.pangaea.de/index.php on line 28  

Line 28 contains the call to get_browser(). All other PHP functions do not
fail. In other scripts which use get_browser() the error also occurs.

The problem is: You cannot reproduce it, because it happens only on heavy
server load and when it happens the first time it does not go away until
server restart.

PHP runs on SunONE with NSAPI, so compiled with ZTS.

I would debug the code and fix the error; but my problem is that I do not
know WHERE in get_browser the error occurs.

Uwe

Reproduce code:
---------------
<?php
    // look if referer comes from google and extract search query
    //
http://www.google.de/search?sourceid=navclient&hl=de&q=%22age%2C+error%22+pangaea
    //
http://www.google.de/search?q=%22age,+error%22+pangaea&hl=de&lr=&ie=UTF-8&filter=0
    if (isset($_GET['query'])) {
        $query=$_GET['query'];
    } else {
        if (isset($_SERVER['HTTP_REFERER']) &&
preg_match('/^http:\/\/.*?google\..*?\/search\?(.*?)$/i',
$_SERVER['HTTP_REFERER'], $matches)) {
            $a = split ('&', $matches[1]);
            for ($i=0; $i<count($a); $i++) {
                $b = split ('=', $a[$i]);
                $name=urldecode ($b[0]);
                $value=urldecode ($b[1]);
                switch ($name) {
                    case 'q':
                        $query=$value;
                        break;
                    case 'ie':
                        $encoding=$value;
                        break;
                }
            }
        }
        if (isset($query) && isset($encoding))
$query=mb_convert_encoding($query, "ISO-8859-1", $encoding);    
    }

    // detect browser
    $browser=get_browser();
    
    // if not crawler redirect user to homepage (do not forget to transmit
query because referer can get invalid after redirect)
    if ((!$browser->crawler) && isset($_SERVER['PATH_INFO'])) {
        if (isset($query)) {
            header("Location:
http://".$_SERVER['HTTP_HOST']."/?query=".urlencode($query));
        } else {
            header("Location: http://".$_SERVER['HTTP_HOST']."/");
        }
        exit();
    }

    // if a crawler like google is visiting: prepare keyword list to
display and extract page number
    if ($browser->crawler) {
        $page=0;
        if (isset($_SERVER['PATH_INFO'])) {
            if (preg_match('/^\/(.*?)\.html$/', $_SERVER['PATH_INFO'],
$matches)) {
                $page=$matches[1];
            } else {
                header("HTTP/1.0 404 Not Found");
                exit();
            }
        }
        $lines=file("../globals/googlelist.txt");
        if ($page*1000>=count($lines)) {
            header("HTTP/1.0 404 Not Found");
            exit();
        }
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
...


-- 
Edit bug report at http://bugs.php.net/?id=25916&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25916&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25916&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25916&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25916&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25916&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25916&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25916&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25916&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25916&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25916&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25916&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25916&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25916&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25916&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25916&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25916&r=float

Reply via email to