Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function getUID() on null in file '/var/www/nextcloud/lib/private/Profile/ProfileManager.php' #35766

Closed
pmarini-nc opened this issue Dec 14, 2022 · 2 comments · Fixed by #39309
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug

Comments

@pmarini-nc
Copy link

pmarini-nc commented Dec 14, 2022

Steps to reproduce

  1. Create an appointment
  2. With a new session, access the profile page of the user that created the appointment

Expected behavior

The appointment booking panel shows

Actual behaviour

Internal error

Calendar app version

4.1.0

CalDAV-clients used

Calendar app

Browser

Firefox 108

Client operating system

Ubuntu Desktop 22.04

Server operating system

Ubuntu Server 22.05

Web server

Apache

Database engine version

MariaDB

PHP engine version

PHP 8.1

Nextcloud version

25.0.2

Updated from an older installed version or fresh install

Fresh install

List of activated apps

Enabled:
  - activity: 2.17.0
  - calendar: 4.1.0
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - contacts: 5.0.1
  - dashboard: 7.5.0
  - dav: 1.24.0
  - deck: 1.8.2
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_fulltextsearch: 24.0.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - fulltextsearch: 24.0.0
  - fulltextsearch_elasticsearch: 24.0.1
  - groupfolders: 13.1.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - mail: 2.2.1
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.3
  - richdocuments: 7.0.2
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - spreed: 15.0.2
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - encryption
  - files_external
  - suspicious_login
  - twofactor_totp
  - user_ldap

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "ncehub-it.localenv.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.2.3",
        "overwrite.cli.url": "https:\/\/ncehub-it.localenv.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "htaccess.RewriteBase": "\/",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "0",
            "timeout": "0.0"
        },
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": "true",
        "default_language": "it",
        "default_phone_region": "it",
        "updater.release.channel": "enterprise",
        "maintenance": false,
        "loglevel": 2,
        "app_install_overwrite": [
            "fulltextsearch",
            "files_fulltextsearch",
            "fulltextsearch_elasticsearch"
        ],
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

Web server error log

No response

Log file

{
  "reqId": "mjRO7CqRqp9qMiCcujCS",
  "level": 3,
  "time": "2022-12-14T09:51:34+00:00",
  "remoteAddr": "10.27.232.1",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/u/ettore",
  "message": "Call to a member function getUID() on null in file '/var/www/nextcloud/lib/private/Profile/ProfileManager.php' line 171",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0",
  "version": "25.0.2.3",
  "exception": {
    "Exception": "Exception",
    "Message": "Call to a member function getUID() on null in file '/var/www/nextcloud/lib/private/Profile/ProfileManager.php' line 171",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1047,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 165,
    "Previous": {
      "Exception": "Error",
      "Message": "Call to a member function getUID() on null",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
          "line": 213,
          "function": "registerAction",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
          "line": 357,
          "function": "getActions",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
          "line": 375,
          "function": "getDefaultProfileConfig",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
          "line": 239,
          "function": "getProfileConfig",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
          "line": 299,
          "function": "isParameterVisible",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/core/Controller/ProfilePageController.php",
          "line": 116,
          "function": "getProfileParams",
          "class": "OC\\Profile\\ProfileManager",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 225,
          "function": "index",
          "class": "OC\\Core\\Controller\\ProfilePageController",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 133,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
          "line": 172,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/lib/private/Route/Router.php",
          "line": 298,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::"
        },
        {
          "file": "/var/www/nextcloud/lib/base.php",
          "line": 1047,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->"
        },
        {
          "file": "/var/www/nextcloud/index.php",
          "line": 36,
          "function": "handleRequest",
          "class": "OC",
          "type": "::"
        }
      ],
      "File": "/var/www/nextcloud/lib/private/Profile/ProfileManager.php",
      "Line": 171
    },
    "CustomMessage": "--"
  }
}

Browser log

No response

Additional info

No response

@pmarini-nc pmarini-nc added the bug label Dec 14, 2022
@tcitworld tcitworld transferred this issue from nextcloud/calendar Dec 14, 2022
@tcitworld
Copy link
Member

Transferred as it's not an appointments issue but a profile one.

@szaimen szaimen added 0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback labels Dec 14, 2022
@solracsf solracsf changed the title Appointments: Call to a member function getUID() on null in file '/var/www/nextcloud/lib/private/Profile/ProfileManager.php' Call to a member function getUID() on null in file '/var/www/nextcloud/lib/private/Profile/ProfileManager.php' Dec 14, 2022
@joshtrichards
Copy link
Member

When you say a new session, do you mean a non-logged in browser window?

Also, do you have any non-default shareapi_* parameters active?

./occ config:list core | grep shareapi

I think there may be some weirdness around here with the instanceof IUser checking below so low:

public function currentUserCanEnumerateTargetUser(?IUser $currentUser, IUser $targetUser): bool {
if ($this->allowEnumerationFullMatch()) {
return true;
}
if (!$this->allowEnumeration()) {
return false;
}
if (!$this->limitEnumerationToPhone() && !$this->limitEnumerationToGroups()) {
// Enumeration is enabled and not restricted: OK
return true;
}
if (!$currentUser instanceof IUser) {
// Enumeration restrictions require an account
return false;

We call the above from here:

if (!$this->shareManager->currentUserCanEnumerateTargetUser($visitingUser, $targetUser)) {

But some further digging will be required.

tcitworld added a commit that referenced this issue Jul 11, 2023
As per method signature, $visitingUser is nullable, so we can't be sure calling getUid() on it will
work.

Closes #35766

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tcitworld added a commit that referenced this issue Jul 11, 2023
As per method signature, $visitingUser is nullable, so we can't be sure calling getUid() on it will
work.

Closes #35766

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
backportbot-nextcloud bot pushed a commit that referenced this issue Jul 17, 2023
As per method signature, $visitingUser is nullable, so we can't be sure calling getUid() on it will
work.

Closes #35766

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
backportbot-nextcloud bot pushed a commit that referenced this issue Jul 17, 2023
As per method signature, $visitingUser is nullable, so we can't be sure calling getUid() on it will
work.

Closes #35766

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
backportbot-nextcloud bot pushed a commit that referenced this issue Jul 17, 2023
As per method signature, $visitingUser is nullable, so we can't be sure calling getUid() on it will
work.

Closes #35766

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants