Keyword

K2 + PHP 8: Error message at auto-login

  • Peter Wolff
  • Peter Wolff's Avatar Topic Author
  • Offline
  • New Member
More
1 year 2 months ago #180715 by Peter Wolff
K2 + PHP 8: Error message at auto-login was created by Peter Wolff
I have Joomla version 3.10.11 and the current K2 version 2.11 [Build 20230112]. After that I switch to PHP 8. About the extension "iCagenda" () is an automatic login via an e-mail link via the front page, if the user is created. Since PHP 8 (8.0 or 8.2) I always get this error message (at error_reporting = 'maximum'):

Deprecated: Creation of dynamic property Joomla\CMS\Cache\Storage\FileStorage::$_threshold is deprecated in /
 0 - Undefined constant "K2_JVERSION"
Deprecated: Creation of dynamic property Joomla\CMS\User::$aid is deprecated in /


Is this error with "iCagenda" or with K2?
Here are the excerpts from the PHP files (the line with error in red):
_____________________________________________________________________
libraries/src/User/ on line 953
// Set time threshold value.  If the lifetime is not set, default to 60 (0 is BAD)
        // _threshold is now available ONLY as a legacy (it's deprecated).  It's no longer used in the core.
        if (empty($this->_lifetime))
        {
            $this->_threshold = $this->_now - 60;
            $this->_lifetime = 60;
        }
        else
        {
            $this->_threshold = $this->_now - $this->_lifetime;
        }
    }
_______________________________________________________________________
libraries/src/Cache/ on line 107

public function __wakeup()
    {
        // Initialise some variables
        $this->userHelper = new UserWrapper;
        $this->_params    = new Registry;

        // Load the user if it exists
        if (!empty($this->id) && $this->load($this->id))
        {
            // Push user into cached instances.
            self::$instances[$this->id] = $this;
        }
        else
        {
            // Initialise
            $this->id = 0;
            $this->sendEmail = 0;
            $this->aid = 0;
            $this->guest = 1;
        }
    }
}

Thank you, Peter

Please Log in or Create an account to join the conversation.

  • Peter Wolff
  • Peter Wolff's Avatar Topic Author
  • Offline
  • New Member
More
1 year 2 months ago #180745 by Peter Wolff
Replied by Peter Wolff on topic K2 + PHP 8: Error message at auto-login
This is the answer from iCagenda:

Hello, I think you're right, this issue is from K2.
But, if you have it on PHP8, that just means some functions used are deprecated, but still working.
Many changes in PHP8, and maybe the developers of K2 have not yet checked all.
You can just report the error messages you got as you have reported it here to the K2 team, as with this information, they will know where and how to fix it (don't forget to mention that issue is on PHP8 only).
Best regards,

Can someone help me or give me a tip on how to solve the problem?
Thanks!
 

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #180751 by JoomlaWorks
Replied by JoomlaWorks on topic K2 + PHP 8: Error message at auto-login
Search in iCagenda's source code for "K2_JVERSION". If you find it, ensure that IF that extension is accompanied by a system plugin, THEIR system plugin is ordered AFTER the K2 System plugin. This way "K2_JVERSION" will be defined first and everything will work as expected.

And yes, K2 is PHP 8 compatible (checked up to 8.1 actually, it's what we run on the K2 demo site).

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Peter Wolff
  • Peter Wolff's Avatar Topic Author
  • Offline
  • New Member
More
1 year 2 months ago - 1 year 2 months ago #180761 by Peter Wolff
Replied by Peter Wolff on topic K2 + PHP 8: Error message at auto-login
Thanks for the feedback!

But since I'm not the expert on iCagenda source code, I forwarded the answer to iCagenda. Here's the answer:

"I'm sorry, but answer from K2 is a bit 's not because the code is working on PHP8, that it is all 100% PHP8 ready..
The error message you reported is not from iCagenda. If it's from a K2 extension, so this one use deprecated function. (it could work, but reports an error on PHP8). But it's not clear from where the error comes from in your message (is it code from K2 plugin or Joomla core ?)
About the K2_JVERSION, there's no such variable in iCagenda. And the issue is not related to plugin ordering.
I all cases, you are on Joomla 3.10, and not sure J3 is 100% updated to PHP 8.1 or
"

Does that mean that Joomla Joomla 3.10.x was generally not checked for PHP 8.x and such problems can occur again and again?
So I would have to switch to Joomla 4.x (which is not yet possible because K2 is not yet compatible with Joomla 4) or should I switch back to PHP 7.x?
Or is there still another way to intercept this "error" under K2?

Thanks! Peter
Last edit: 1 year 2 months ago by Peter Wolff.

Please Log in or Create an account to join the conversation.

More
1 year 1 month ago #180801 by JoomlaWorks
Replied by JoomlaWorks on topic K2 + PHP 8: Error message at auto-login
I already provided you with the solution. Order the K2 System plugin first and ensure that in K2's Settings, under the "Site" tab, the option "Enable K2 user profile" is set to "no".

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum