Keyword

K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
2 months 6 days ago #168486 by Andreas Schrader
Andreas Schrader created the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
I have a Website with a K2 Profile Edit Site in the Frontend. When I click on the save Button, the Site throws the Error "Using $this when not in object context".
The Site and Function worked fine with PHP 7.0 but throws this Error when I changed the PHP Version to 7.1 or higher.

Do you have any suggestions, what I have to change in the Code to fix this? Changing the PHP Version back to 7.0 is not an option, because my Client wants to change the PHP Version directly to 7.2.

Thanks for your Feedback :)

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

More
2 months 6 days ago #168495 by Krikor Boghossian
Krikor Boghossian replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
Are you using any overrides?
Also can you send me the line where this error occurs ?
It must have been printed or recorded in your error log.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
2 months 5 days ago #168499 by Andreas Schrader
Andreas Schrader replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
I checked the Code and there is no Override for the Profile edit Page.
I enabled the Debug Mode and it show the following Error:
Attachments:

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

More
2 months 1 day ago #168522 by Krikor Boghossian
Krikor Boghossian replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
2 months 10 hours ago #168527 by Andreas Schrader
Andreas Schrader replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
I removed the file and now it works fine. Thanks.

I also changed the Code in line 142 to: $menu = $application->getMenu(); because the JSite will no longer work
github.com/getk2/k2/blob/master/plugins/user/k2.php#L142

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
2 months 10 hours ago #168528 by Andreas Schrader
Andreas Schrader replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
I removed the line and now it works fine. Thanks.

I also changed the Code in line 142 to: $menu = $application->getMenu(); because the JSite will no longer work
github.com/getk2/k2/blob/master/plugins/user/k2.php#L142

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

More
2 months 5 hours ago #168530 by Krikor Boghossian
Krikor Boghossian replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
Nice :)
I will investigate why PHP 7.2 does not like this.
Care to make a PR for $menu = $application->getMenu(); ?

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
1 month 3 weeks ago #168595 by Andreas Schrader
Andreas Schrader replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
Shure I will create a PR for you :)

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

More
1 month 3 weeks ago #168602 by Krikor Boghossian
Krikor Boghossian replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
Thank you Andreas :)

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

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

More
1 month 3 weeks ago - 1 month 3 weeks ago #168619 by burnyourears
burnyourears replied the topic: K2 Edit Profile shows Error in Frontend after change to PHP 7.2.7
I have the same problem (mentioned here – sorry, did not see that there's already this topic ...) and also deleted the line in the k2.php. The result: Error-Message is fixed BUT changes are not saved any more ... :/

The weird thing: When I get the error, changes are saved though ...

Andreas, after you changed the code – are changes in the user profile still saved?
Last Edit: 1 month 3 weeks ago by burnyourears.

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

Moderators: william white