Cannot access protected property ShowgroupAction::$group
Closed, ResolvedPublic

Description

This error happens when I view a group, e.g.:
https://social.mxchange.org/group/mailerproject

[12-Sep-2014 15:39:02 UTC] PHP Fatal error:  Cannot access protected property ShowgroupAction::$group in /var/www/htdocs/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php on line 396
[12-Sep-2014 15:39:02 UTC] PHP Stack trace:
[12-Sep-2014 15:39:02 UTC] PHP   1. {main}() /var/www/htdocs/index.php:0
[12-Sep-2014 15:39:02 UTC] PHP   2. main() /var/www/htdocs/index.php:333
[12-Sep-2014 15:39:02 UTC] PHP   3. call_user_func() /var/www/htdocs/index.php:319
[12-Sep-2014 15:39:02 UTC] PHP   4. Action::run() /var/www/htdocs/index.php:319
[12-Sep-2014 15:39:02 UTC] PHP   5. Action->execute() /var/www/htdocs/lib/action.php:101
[12-Sep-2014 15:39:02 UTC] PHP   6. ShowgroupAction->handle() /var/www/htdocs/lib/action.php:123
[12-Sep-2014 15:39:02 UTC] PHP   7. Action->showPage() /var/www/htdocs/actions/showgroup.php:129
[12-Sep-2014 15:39:02 UTC] PHP   8. Action->showBody() /var/www/htdocs/lib/action.php:224
[12-Sep-2014 15:39:02 UTC] PHP   9. Action->showCore() /var/www/htdocs/lib/action.php:585
[12-Sep-2014 15:39:02 UTC] PHP  10. Action->showAside() /var/www/htdocs/lib/action.php:830
[12-Sep-2014 15:39:02 UTC] PHP  11. Event::handle() /var/www/htdocs/lib/action.php:1020
[12-Sep-2014 15:39:02 UTC] PHP  12. call_user_func_array() /var/www/htdocs/lib/event.php:105
[12-Sep-2014 15:39:02 UTC] PHP  13. GroupPrivateMessagePlugin->onStartShowExportData() /var/www/htdocs/lib/event.php:105
Quix0r created this task.Via WebSep 12 2014, 11:42 AM
Quix0r added a subscriber: Quix0r.
Quix0r added a project: GNU social
pztrn added a subscriber: pztrn.Via WebSep 12 2014, 11:52 AM
Quix0r added a comment.Via WebSep 12 2014, 2:59 PM

I would recommend a getter in GroupAction and not set $group back to public/var.

Quix0r added a comment.Via WebSep 12 2014, 4:52 PM

I have attempted to fix it the way I wrote here:
https://gitorious.org/statusnet/quix0rs-gnu-social/graph/23fe24adefc7616f4d7b5314681d788475d85a4e?page=1

So here are the possible commits for cherry-picking:

  • #f500b59
  • #16ba945
  • #457586e

You may pick more than needed for this ticket.

mmn closed this task as "Resolved".EditedVia WebOct 25 2014, 8:30 AM
mmn claimed this task.

I applied your fixes and also commited this:

commit 048af5ac732c5fc37b5f218fb498576987e7f69e
Author: Mikael Nordfeldth <mmn@hethane.se>
Date:   Sat Oct 25 14:29:27 2014 +0200

    Can't use empty on a function call

diff --git a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
index 13c4659..2fd9e3e 100644
--- a/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
+++ b/plugins/GroupPrivateMessage/GroupPrivateMessagePlugin.php
@@ -194,7 +194,7 @@ class GroupPrivateMessagePlugin extends Plugin

         $gps = null;

-        if (!empty($action->getGroup())) {
+        if ($action->getGroup() instanceof User_group) {
             $gps = Group_privacy_settings::getKV('group_id', $action->getGroup()->id);
         }

Add Comment