ports/140023: PHP "basename" chops first character in filename

Per olof Ljungmark peo at intersonic.se
Tue Oct 27 19:00:06 UTC 2009


>Number:         140023
>Category:       ports
>Synopsis:       PHP "basename" chops first character in filename
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 27 19:00:06 UTC 2009
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



More information about the freebsd-ports-bugs mailing list