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
6 years 4 months ago #168486 by Andreas Schrader
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.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168495 by Krikor Boghossian
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.

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

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
6 years 4 months ago #168499 by Andreas Schrader
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.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168522 by Krikor Boghossian

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

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
6 years 4 months ago #168527 by Andreas Schrader
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
6 years 4 months ago #168528 by Andreas Schrader
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.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168530 by Krikor Boghossian
Nice :)
I will investigate why PHP 7.2 does not like this.
Care to make a PR for $menu = $application->getMenu(); ?

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

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

  • Andreas Schrader
  • Andreas Schrader's Avatar Topic Author
  • Offline
  • New Member
More
6 years 4 months ago #168595 by Andreas Schrader
Shure I will create a PR for you :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 4 months ago #168602 by Krikor Boghossian
Thank you Andreas :)

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

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

More
6 years 3 months ago - 6 years 3 months ago #168619 by burnyourears
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: 6 years 3 months ago by burnyourears.

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


Powered by Kunena Forum