From nobody@FreeBSD.org  Tue Oct 27 18:52:48 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0BE5E106568B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Oct 2009 18:52:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id DF7EC8FC2E
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Oct 2009 18:52:47 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n9RIqlLD051583
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 27 Oct 2009 18:52:47 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n9RIqlAU051582;
	Tue, 27 Oct 2009 18:52:47 GMT
	(envelope-from nobody)
Message-Id: <200910271852.n9RIqlAU051582@www.freebsd.org>
Date: Tue, 27 Oct 2009 18:52:47 GMT
From: Per olof Ljungmark <peo@intersonic.se>
To: freebsd-gnats-submit@FreeBSD.org
Subject: PHP "basename" chops first character in filename
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         140023
>Category:       ports
>Synopsis:       lang/php5 - PHP "basename" chops first character in filename
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 27 19:00:06 UTC 2009
>Closed-Date:    Tue Dec 01 11:36:50 UTC 2009
>Last-Modified:  Tue Dec 01 11:36:50 UTC 2009
>Originator:     Per olof Ljungmark
>Release:        7-STABLE
>Organization:
BSDLabs AB
>Environment:
FreeBSD direwolf.inter-sonic.com 7.2-STABLE FreeBSD 7.2-STABLE #0: Thu Oct 15 07:23:17 CEST 2009
>Description:
The platform is: 
FreeBSD 7.2-STABLE #0: Thu Oct 15 07:23:17 CEST 2009
PHP 5.2.11 with Suhosin-Patch 0.9.7 (cli) (built: Oct 15 2009 22:16:22)
apache-2.2.13


- Problem not tied to a specific version of OS or PHP
- Vanilla installation of Horde http://www.horde.org
- Identical problem present on two servers
- Problem started to occur spring 2009
- Low server load
- Intermittent
- Comes and goes at certain times during the day. Usually, the problem will start around 11:30 CEST or 10:30 CET, last for 24h and then go away for another 24h.
	And yes, we have looked for causes for this behaviour
- Happens regardless of cache configuration in Horde, even without any caching
- Happens regardless of cache and session settings in php.ini
- The below is an *example*
- One more user on the Horde lists have reported same problem with same OS (FreeBSD)

>How-To-Repeat:
Install Horde/PHP5/Apache from ports and wait.

Backtrace from php's log

[21-Oct-2009 07:28:28] after basename d string(8) "memcache"
string(7) "emcache"

[21-Oct-2009 07:28:28] backtrace NULL
string(7) "emcache"
#0  Horde_Cache->factory(memcache, Array ([hostspec] => Array ([0] => localhost),[port] => Array ([0] => 11211),[weight] => Array (),[persistent] => ,[compression] => ,[large_items] => 1,[enabled] => 1)) called at [/usr/local/www/horde/lib/Horde/Cache.php:234]
#1  Horde_Cache->singleton(memcache, Array ([hostspec] => Array ([0] => localhost),[port] => Array ([0] => 11211),[weight] => Array (),[persistent] => ,[compression] => ,[large_items] => 1,[enabled] => 1)) called at [/usr/local/www/horde/lib/Horde/Perms/sql.php:57]
#2  Perms_sql->Perms_sql(Array ([username] => horde,[password] => <password>,[protocol] => unix,[database] => horde,[charset] => iso-8859-1,[splitread] => ,[ssl] => ,[phptype] => mysqli)) called at [/usr/local/www/horde/lib/Horde/Perms.php:462]
#3  Perms->factory(sql, Array ([username] => horde,[password] => <password>,[protocol] => unix,[database] => horde,[charset] => iso-8859-1,[splitread] => ,[ssl] => ,[phptype] => mysqli)) called at [/usr/local/www/horde/lib/Horde/Perms.php:496]
#4  Perms->singleton() called at [/usr/local/www/horde/lib/Horde/Registry.php:278]
#5  Registry->Registry(0) called at [/usr/local/www/horde/lib/Horde/Registry.php:139]
#6  Registry::singleton() called at [/usr/local/www/horde/imp/lib/base.php:49]
#7  require_once(/usr/local/www/horde/imp/lib/base.php) called at [/usr/local/www/horde/imp/redirect.php:89]
#8  require(/usr/local/www/horde/imp/redirect.php) called at [/usr/local/www/horde/imp/index.php:26]
NULL

[21-Oct-2009 07:28:28] PHP Warning:  include_once(Horde/Cache/emcache.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /usr/local/www/horde/lib/Horde/Cache.php on line 194
[21-Oct-2009 07:28:28] PHP Warning:  include_once() [<a href='function.include'>function.include</a>]: Failed opening 'Horde/Cache/emcache.php' for inclusion (include_path='/usr/local/www/horde/lib:.:/usr/local/share/pear') in /usr/local/www/horde/lib/Horde/Cache.php on line 194
[21-Oct-2009 07:28:39] after basename d string(8) "memcache"
string(7) "emcache"

*example* of where this occurs:

    function factory($driver, $params = array())
    {
        if (is_array($driver)) {
            $app = $driver[0];
            $driver = $driver[1];
        }
        $driver = basename($driver);
        if (empty($driver) || $driver == 'none') {
            return new Horde_Cache($params);
        }
        if (!empty($app)) {
            include_once $app . '/lib/Cache/' . $driver . '.php';
        } elseif (file_exists(dirname(__FILE__) . '/Cache/' . $driver . '.php')) {
            include_once dirname(__FILE__) . '/Cache/' . $driver . '.php';
        } else {
            include_once 'Horde/Cache/' . $driver . '.php';
        }
        $class = 'Horde_Cache_' . $driver;
        if (class_exists($class)) {
            $cache = new $class($params);
        } else {
            $cache = PEAR::raiseError('Class definition of ' . $class . ' not found.');
        }
        return $cache;
    }
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ale 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Oct 27 20:46:04 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=140023 
State-Changed-From-To: open->feedback 
State-Changed-By: ale 
State-Changed-When: Wed Oct 28 07:10:16 UTC 2009 
State-Changed-Why:  
Apache pre-fork or multi-thread? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=140023 

From: Per olof Ljungmark <peo@intersonic.se>
To: bug-followup@FreeBSD.org, peo@intersonic.se
Cc:  
Subject: Re: ports/140023: lang/php5 - PHP "basename" chops first character
 in filename
Date: Wed, 28 Oct 2009 10:05:03 +0100

 prefork
State-Changed-From-To: feedback->closed 
State-Changed-By: ale 
State-Changed-When: Tue Dec 1 11:35:57 UTC 2009 
State-Changed-Why:  
Close as submitter request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=140023 
>Unformatted:
