Welcome Guest, Not a member yet? Register   Sign In
CI 1.6 >> Error when trying to decode using Encrypt library in PHP4.4.7
#1

[eluser]stevepaperjam[/eluser]
Putting my rubbish track record in bug reporting to one side for a moment, I've had a error in CI 1.6 (rev.941) in the Encrypt library.

I'm getting the error Call to a member function on a non-object in (...)libraries/Encrypt.php in my logs under PHP4.4.7 when trying to decode a string.

If I flip to PHP5.2.3 all's well.

I made the following change to Encrypt.php's decode function (line 142 onwards):

Code:
$key = $this->get_key($key);
$this->CI =& get_instance(); // new line here
$this->CI->load->library('validation');

...and this worked for me, but it might not be getting at the root of the problem. Can any PHP4ers out there confirm this bug and fix?
#2

[eluser]Shodan[/eluser]
[quote author="stevepaperjam" date="1202080625"]Putting my rubbish track record in bug reporting to one side for a moment, I've had a error in CI 1.6 (rev.941) in the Encrypt library.

I'm getting the error Call to a member function on a non-object in (...)libraries/Encrypt.php in my logs under PHP4.4.7 when trying to decode a string.

If I flip to PHP5.2.3 all's well.

I made the following change to Encrypt.php's decode function (line 142 onwards):

Code:
$key = $this->get_key($key);
$this->CI =& get_instance(); // new line here
$this->CI->load->library('validation');

...and this worked for me, but it might not be getting at the root of the problem. Can any PHP4ers out there confirm this bug and fix?[/quote]

Hey..

Yeah, I've just had the same problem and your fix worked for me as well.

To confirm, I'm running PHP 5.2.5 on my dev machine and Encrypt.php works fine WITHOUT the above hack.

On a shared host running PHP 4.4.8, I experienced the error, which IS fixed by the above hack.

Cheers,
Terry
#3

[eluser]stevepaperjam[/eluser]
Terry - Thanks for confirming, I'll put a bug report in...

cheers
#4

[eluser]Unknown[/eluser]
This fix stopped me from getting an error on my PHP4.4.7 machine, but i still have one funny issue, when i actually use encode i get results like :

La9NxZb2+JJ/9R0WKhkVwDVLJzQlwVsdQAul4Ze3jcii/+B/6Zn5cdsPZ13LPd0qt1VS7hxyzbVUedcKFmqIag==

which have the slashes in them. Same code between the two environments, different encode results (php5 enviroment produces a 3 character string for the same value encoded). Did any of you get similar issues?
#5

[eluser]stevepaperjam[/eluser]
I'm not using the encrypt functionality in my app, but I created a quick test controller to see what would happen, using the example from the manual pretty much verbatim, and it seems to work fine.

I encoded "My secret message" without a key, and got (deep breath)

ooMeKjNhz9mNX2mOMNvSELW1ppkuo1jASBMgaxPasOZdsKXIfUpu/sEZvXig6lC72LCLPre2FiBabUhJgRr0K3N+ihNEGv8VGfF2lp0H7U6BWGZtvt/ICFbfa5e634wO

Slashes and all. Decoding this behemoth got me "My secret message" back again.

Refreshing my page got me a different encoded version, but after decoding again I always got "My secret message" back at the end.

I'm still on PHP4.something because my (reliable, but dull) provider won't change. I haven't tried it on PHP5, I could flip to it and see how that works.




Theme © iAndrew 2016 - Forum software by © MyBB