Edit report at https://bugs.php.net/bug.php?id=63026&edit=1

 ID:                 63026
 Updated by:         larue...@php.net
 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:

你用中文描述吧, 我实在看不懂你说什么错误.... 
另外, 请提供一个可以正常运行的可重试脚本. 
(you can re-describe this problem in chinese, previous one is hard to read).

thanks


Previous Comments:
------------------------------------------------------------------------
[2012-09-10 07:44:44] ian dot xspace at yahoo dot cn

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
        //在错误写法下居然有的能成功有的不能成功
}

------------------------------------------------------------------------
[2012-09-07 17:19:21] larue...@php.net

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

Reply via email to