From: ian dot xspace at yahoo dot cn
Operating system: windows 7
PHP version: 5.3.16
Package: *Compile Issues
Bug Type: Bug
Bug description:require_once error
Description:
------------
<?php
//OS: win7 php:5.3.16 mysql:5.5
//such as [Some code snippets]
//Assume WEB_ROOT = 'E:/www';
define('WEB_ROOT', strtr(dirname(__FILE__), '\\', '/'));
//define the web system directory
define('TEMP', WEB_ROOT.DS.'temp');
define('LIBS', WEB_ROOT.DS.'libs');
define('VIEWS', WEB_ROOT.DS.'views');
define('LOGS', VIEWS.DS.'logs');
define('DYN', VIEWS.DS.'dynamic');
define('HLP', WEB_ROOT.DS.'helpers');
define('PLNS', WEB_ROOT.DS.'plugins');
define('CONFS', WEB_ROOT.DS.'configs');
define('MODELS', WEB_ROOT.DS.'models');
define('CTRLS', WEB_ROOT.DS.'controls');
//define associate
/* Error writing */
class SYS
{
private function sysModule()
{
return array(
'M'=>'MODELS', 'V'=>'VIEWS',
'C'=>'CTRLS', 'L'=>'LIBS',
'P'=>'PLNS', 'H'=>'HLP'
);
}
public static function getSys($fun)
{
return self::$fun();
}
}
//common.php load some calss file
//Assume $type = 'M.className';
function loadSomeClass($type)
{
$csName = substr($cs, 2);
$type = strtoupper(strtok($cs, '.'));
$moArr = SYS::getSys('sysModule'); //find module
require_once($moArr[$type].DS."{$csName}.php");
}
//bugs: In accordance with the above wording some successful and some can
not successfully ?????
/*
private function sysModule()
{
return array(
'M'=>MODELS, 'V'=>VIEWS,
'C'=>CTRLS, 'L'=>LIBS,
'P'=>PLNS, 'H'=>HLP
);
}
*/
?>
Test script:
---------------
<?php
//OS: win7 php:5.3.16 mysql:5.5
//such as [Some code snippets]
//Assume WEB_ROOT = 'E:/www';
define('WEB_ROOT', strtr(dirname(__FILE__), '\\', '/'));
//define the web system directory
define('TEMP', WEB_ROOT.DS.'temp');
define('LIBS', WEB_ROOT.DS.'libs');
define('VIEWS', WEB_ROOT.DS.'views');
define('LOGS', VIEWS.DS.'logs');
define('DYN', VIEWS.DS.'dynamic');
define('HLP', WEB_ROOT.DS.'helpers');
define('PLNS', WEB_ROOT.DS.'plugins');
define('CONFS', WEB_ROOT.DS.'configs');
define('MODELS', WEB_ROOT.DS.'models');
define('CTRLS', WEB_ROOT.DS.'controls');
//define associate
/* Error writing */
class SYS
{
private function sysModule()
{
return array(
'M'=>'MODELS', 'V'=>'VIEWS',
'C'=>'CTRLS', 'L'=>'LIBS',
'P'=>'PLNS', 'H'=>'HLP'
);
}
public static function getSys($fun)
{
return self::$fun();
}
}
//common.php load some calss file
//Assume $type = 'M.className';
function loadSomeClass($type)
{
$csName = substr($cs, 2);
$type = strtoupper(strtok($cs, '.'));
$moArr = SYS::getSys('sysModule'); //find module
require_once($moArr[$type].DS."{$csName}.php");
}
//bugs: In accordance with the above wording some successful and some can
not successfully ?????
/*
private function sysModule()
{
return array(
'M'=>MODELS, 'V'=>VIEWS,
'C'=>CTRLS, 'L'=>LIBS,
'P'=>PLNS, 'H'=>HLP
);
}
*/
?>
Expected result:
----------------
private function sysModule()
{
return array(
'M'=>'MODELS', 'V'=>'VIEWS',
'C'=>'CTRLS', 'L'=>'LIBS',
'P'=>'PLNS', 'H'=>'HLP'
);
}
error writing!
why require_once some successful and some error
--
Edit bug report at https://bugs.php.net/bug.php?id=63026&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=63026&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=63026&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=63026&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=63026&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=63026&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=63026&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=63026&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=63026&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=63026&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=63026&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=63026&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63026&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63026&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=63026&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=63026&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63026&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=63026&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=63026&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=63026&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=63026&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=63026&r=mysqlcfg