Welcome Guest, Not a member yet? Register   Sign In
Number in controller class name
#1

[eluser]BrianL[/eluser]
Hi,

My apologies if this has been posted before.

Was wondering if anyone came across this issue of using numbers in class names:

Try extending controller. Very simple stuff.

/system/application/libraries/MY_Controller0.php
Code:
<?php

class MY_Controller0 extends Controller {

    function MY_Controller0()
    {
        parent::Controller();
    }
    
}

?>

/system/application/controllers/Check.php
Code:
<?php

class Check extends MY_Controller0 {

    function Check()
    {
        parent::MY_Controller0();
    }

}

?>

Now it does not work with the number 0, or _0 and gives a PHP class not found error in the logs. But remove the zero, and it works.

Code:
[28-Jun-2010 19:22:59] PHP Fatal error:  Class 'MY_Controller0' not found in /system/application/controllers/Check.php on line 3

Tested on a fresh, clean install of CodeIgniter 1.7.2 and code cut and pasted. Simply delete the zeroes, and it works. Add in the zeroes and it does not (yes, there are zeroes in two places in Check.php and three places in MY_Controller0.php including the file name).

Also confirmed I have saved in correct file format UTF-8 without BOM with UNIX line returns, and uploaded in binary mode.

Please someone test this themselves, since it is driving me crazy Wink


Messages In This Thread
Number in controller class name - by El Forum - 06-28-2010, 05:28 PM
Number in controller class name - by El Forum - 06-28-2010, 05:58 PM
Number in controller class name - by El Forum - 06-28-2010, 06:04 PM
Number in controller class name - by El Forum - 06-28-2010, 07:25 PM
Number in controller class name - by El Forum - 06-28-2010, 07:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB