From:             peo at bsdlabs dot com
Operating system: FreeBSD
PHP version:      5.2.11
PHP Bug Type:     Filesystem function related
Bug description:  "basename" chops first character in filename

Description:
------------
The platform is: 
FreeBSD 7.2-STABLE #0: Thu Oct 15 07:23:17 CEST 2009
- 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)

Reproduce code:
---------------
    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;
    }

Expected result:
----------------
Should return memcache.php in this case, but it could be "none.php" (where
the actual output will be "one.php")

Actual result:
--------------
[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"

-- 
Edit bug report at http://bugs.php.net/?id=50024&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50024&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50024&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50024&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50024&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50024&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50024&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50024&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50024&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50024&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50024&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50024&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50024&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50024&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50024&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50024&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50024&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50024&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50024&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50024&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50024&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50024&r=mysqlcfg

Reply via email to