• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
different behaviour when "passing on libraries" in apache/php5 and iis/php4

Dear all,

I currently experiencing a strange problem. I'm developing a site on my pc, running apache with php5. The thing is deployed on a web server running IIS with php4. The problem is the following: I wrote a library that among other things tracks some general information such as the language that is being used. This information is set in the controller as this:


When I want to use this information later on in a view, i'll have a method


Here it comes: while things work fine on the php5 host, on the php4 host the getLanguage call returns an empty string (the default value). After investigating this problem it turns out that in the php5 case the libraries are correctly "passed-on" to the views, whereas in the php4 case the libraries are newly instantiated...

Has anyone come across this problem, any ideas how to fix it?

Best regards,


A fix for this problem is the following code snippet which I added on top of each view file.

if ( version_compare( phpversion(), '5', '<' ) ) {
        $myCI =& get_instance();
        $this->reader =& $myCI->reader;
        $this->auth =& $myCI->auth;

This way, I make sure that the local references in the view actually reference the library objects of the CI object. It's quite silly though, so any help is very much appreciated.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.