Part of the EllisLab Network
   
 
CI 1.6 >> Error when trying to decode using Encrypt library in PHP4.4.7
Posted: 03 February 2008 12:17 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  94
Joined  03-05-2006

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):

$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?

Profile
 
 
Posted: 11 March 2008 10:59 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  13
Joined  03-09-2007
stevepaperjam - 03 February 2008 12:17 PM

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):

$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?

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

Profile
 
 
Posted: 11 March 2008 04:38 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  94
Joined  03-05-2006

Terry - Thanks for confirming, I’ll put a bug report in…

cheers

Profile
 
 
Posted: 10 June 2008 05:27 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  1
Joined  07-26-2007

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?

Profile
 
 
Posted: 11 June 2008 07:13 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  94
Joined  03-05-2006

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.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 60651 Total Logged-in Users: 37
Total Topics: 73045 Total Anonymous Users: 3
Total Replies: 393858 Total Guests: 402
Total Posts: 466903    
Members ( View Memberlist )