Extension, Plugin

Archived
Forum
(read-only)

EE ShareThis

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Protean Web

     

PHP Errors

Support Request

displayground
displayground

Hello,

Just purchased the add-on last night v 1.2.1

- have added the publisher key to settings
- added head tag and button tag

I immediately get the following error
Fatal error: Call to undefined method EE_Session::cache() in /system/expressionengine/third_party/sharethis/ext.sharethis.php on line 110

Would appreciate some help getting this sorted out.

Thanks.

jayalfredprufrock
# 1
Developer
jayalfredprufrock

Hello, what version of ExpressionEngine do you have installed?

displayground
# 2
displayground

Sorry about that, v2.1.3 - Build:  20101220

Thanks.

jayalfredprufrock
# 3
Developer
jayalfredprufrock

Actually, I think I just figured it out. I believe you might be running a version of PHP that doesn’t support the __construct() generic constructor function. I’ll go ahead and switch back to use the old-style constructor and see if that fixes your problem. Give me a minute and I’ll upload a new version.

displayground
# 4
displayground

FYI, running PHP Version 5.2.13

jayalfredprufrock
# 5
Developer
jayalfredprufrock

Hmm, well maybe that isn’t the issue. And on second hand, the old way of naming a constructor is deprecated, so I better not revert back. Still, it appears that the EE instance is never being retrieved, which happens in the constructor. You could try renaming the __construct function to the name of the class and see if that fixes the issue, but I believe PHP 5.2.13 should support __construct just fine.

displayground
# 6
displayground

Not sure how to do that.  Can you provide the code? Would like to get this working.

jayalfredprufrock
# 7
Developer
jayalfredprufrock

Would it be possible to upgrade ExpressionEngine to the latest version? I’m looking at the changelog, and there appears to be a couple potentially related issues they resolved in subsequent versions. Version 2.1.3 is a year old, and I haven’t had anybody else with the same issue you’re having, so either its some crazy server configuration thing, or an old bug in ExpressionEngine.

jayalfredprufrock
# 8
Developer
jayalfredprufrock

If you wanted to try changing the Add-On code before upgrading ExpressionEngine, that’s fine, but keep in mind that if you ever update PHP to 5.3+, the old style constructor will stop functioning, and you’ll likely see the same error you are now.

To use old style constructors, open up both ext.sharethis.php and pi.sharethis.php and rename the function __construct to the name of the class. So in the case of ext.sharethis.php, you would rename “__construct” to “Sharethis_ext” and for pi.sharethis.php, “__construct” would be changed to just “Sharethis”.

Again, there is no guarantee this will solve your problem, but I have a feeling this is what is causing the issue. In the changelog a couple of versions after yours, I noticed a bugfix that mentioned issues using the __construct function in plugins, which would explain the behavior you are experiencing. If at all possible though, I recommend upgrading ExpressionEngine, as there have been several important bugs and security issues resolved over the past year.

displayground
# 9
displayground

We were able to get the upgrade done over the weekend.  That has sorted this issue.

jayalfredprufrock
# 10
Developer
jayalfredprufrock

Glad to hear that solved your problem. I’m going to close this thread, but feel free to start a new one if anything else comes up.