Edit report at https://bugs.php.net/bug.php?id=63026&edit=1
ID: 63026
Comment by: ian dot xspace at yahoo dot cn
Reported by: ian dot xspace at yahoo dot cn
Summary: require_once error
Status: Feedback
Type: Bug
Package: *Compile Issues
Operating System: windows 7
PHP Version: 5.3.16
Block user comment: N
Private report: N
New Comment:
private function sysModule()
{
//error writing éè¯¯åæ³
return array(
'M'=>MODELS, 'V'=>VIEWS,
'C'=>CTRLS, 'L'=>LIBS,
'P'=>PLNS, 'H'=>HLP
);
//right wring æ£ç¡®åæ³
return array(
'M'=>MODELS, 'V'=>VIEWS,
'C'=>CTRLS, 'L'=>LIBS,
'P'=>PLNS, 'H'=>HLP
);
}
//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");
//Error wording actually some successful and some not successful
//å¨éè¯¯åæ³ä¸å±
ç¶æçè½æåæçä¸è½æå
}
Previous Comments:
------------------------------------------------------------------------
[2012-09-07 17:19:21] [email protected]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2012-09-07 05:28:30] ian dot xspace at yahoo dot cn
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 this bug report at https://bugs.php.net/bug.php?id=63026&edit=1