Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access protected property MY_Loader::$_ci_cached_vars #22

Open
carlotrimarchi opened this issue Oct 28, 2011 · 7 comments
Open

Comments

@carlotrimarchi
Copy link

Hi,
when I try to run the dwoo_test I get this error:

PHP Fatal error: Cannot access protected property MY_Loader::$_ci_cached_vars in /home/carlo/public_html/website/application/libraries/MY_Parser.php on line 146

I'm using the last CodeIgniter version downloaded from github.

Any ideas?

@jackperry
Copy link

This is caused because CodeIgniter changed $_ci_cached_vars to a protected variable. Hopefully this can get fixed on either end.

@carlotrimarchi
Copy link
Author

so, there's nothing I can do right now?

@jackperry
Copy link

You can comment out line 146 in MY_Parser.php, but I wouldn't recommend it, I don't know if it breaks anything anywhere else.

@carlotrimarchi
Copy link
Author

I'd prefer waiting for an official fix. Do you know if they are still developing this project?

@ruthlessfish
Copy link
Contributor

this library doesn't come with a MY_Parser class so I'm guessing that is your code that is breaking. $_ci_cached_vars is protected but you can now use $this->load->get_var('foo') instead of $this->load->_ci_cached_vars['foo']

@carlotrimarchi
Copy link
Author

@bubbafoley: the My_Parser is a Dwoo Parser Class. I'm using it since it's explained so in the documentation:

NOTE: You can only use the Parser if you have also installed a Parser extensions like codeigniter-dwoo. This is because CI_Parser does not play nicely with arrays.

anyway, the line throwing the error is this:

$data = array_merge($data, $this->_ci->load->_ci_cached_vars);

@ruthlessfish
Copy link
Contributor

Ah, I see now. That's a bug in the codeigniter-dwoo library so you might be better off moving this issue over there https://github.com/philsturgeon/codeigniter-dwoo.

What I would do, though, is create application/core/MY_Loader.php and redeclare _ci_cached_vars as public

<?php

class MY_Loader extends CI_Loader {
    public $_ci_cached_vars;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants