EllisLab text mark
Advanced Search
     
$this->config in model breaks Output.php
Posted: 30 September 2007 09:23 PM   [ Ignore ]
Joined: 2006-06-17
151 posts

Use of a local class variable $config breake /system/libraries/Output.php.
(suspect same for controllers etc)

To reproduce:

1. Step 1 : Create model

class MyModel extends Model {

var $config;

   function 
GalleryModel()
   
{
      parent
::Model();
      
$this->obj =& get_instance();

      
$this->config '';

   
}

2. Step 2. Create model instamce (in controller)

$this->load->model('mymodel'); 

Ouput.php breaks here (when trying to invole global $CFG

// Is compression requested?
                
if ($CFG->item('compress_output') === TRUE)
                
{
                        
if (extension_loaded('zlib'))
                        ...
                 

Thank you.

 Signature 

CodeCrafter - Open Source Code Generation for CI

 
Posted: 30 September 2007 10:33 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-03-23
3194 posts

Config is a reserved word.  Do you htink that could account for this Crafter?

 Signature 

DerekAllard.com - CodeIgniter, ExpressionEngine, and the World of Web Design

 
Posted: 30 September 2007 10:45 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2006-06-17
151 posts

It could, Derek, but I’m running PHP 5.1.2 , and the docs say the reserved word limitations apply to PHP 4.

It seems like the the documentation is misplaced, as it is listed under the controllers section. I’m experiencing this on a model.

It’s definitely a scope issue, and typically because my Model inherits from the CI Model.

I’ve worked around this ny mapping my db field (config) to a copy variable.

Perhaps a recommendation is to prefix reserved words with ‘ci_’.

 Signature 

CodeCrafter - Open Source Code Generation for CI