Skip to content

[Bug]: Undefined constant SHARE_TYPE_USER when sharing files #55788

@svoop

Description

@svoop

⚠️ This issue respects the following points: ⚠️

Bug description

Since a silent update of the Docker image I pulled yesterday, the following is logged whenever I try to share or unshare a file:

[no app in context] Error: Undefined constant OCP\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154
	DELETE /ocs/v2.php/apps/files_sharing/api/v1/shares/521?format=json
	from ***REMOVED SENSITIVE VALUE*** at Oct 15, 2025, 2:13:11 PM

Steps to reproduce

  1. Share a file
  2. Check the logs

Expected behavior

Sharing works.

Nextcloud Server version

32

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.bitcetera.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "32.0.0.13",
        "overwrite.cli.url": "https:\/\/cloud.bitcetera.com",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "theme": "",
        "loglevel": 0,
        "maintenance": false,
        "default_phone_region": "FR",
        "app_install_overwrite": [
            "impersonate",
            "news",
            "maps"
        ],
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "data-fingerprint": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto, 30",
        "allowed_admin_ranges": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "updater.release.channel": "stable",
        "maintenance_window_start": 1,
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": []
    }
}

List of activated Apps

Enabled:
  - activity: 5.0.0-dev.0
  - admin_audit: 1.22.0
  - bruteforcesettings: 5.0.0-dev.0
  - calendar: 6.0.2
  - circles: 32.0.0
  - cloud_federation_api: 1.16.0
  - comments: 1.22.0
  - contacts: 8.0.3
  - contactsinteraction: 1.13.1
  - dashboard: 7.12.0
  - dav: 1.34.2
  - federatedfilesharing: 1.22.0
  - files: 2.4.0
  - files_downloadlimit: 5.0.0-dev.0
  - files_pdfviewer: 5.0.0-dev.0
  - files_reminders: 1.5.0
  - files_sharing: 1.24.0
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - impersonate: 3.0.0
  - logreader: 5.0.0-dev.0
  - lookup_server_connector: 1.20.0
  - mail: 5.5.9
  - maps: 1.6.0
  - news: 27.0.0
  - nextcloud_announcements: 4.0.0-dev.0
  - notifications: 5.0.0-dev.0
  - oauth2: 1.20.0
  - password_policy: 4.0.0-dev.0
  - photos: 5.0.0-dev.1
  - privacy: 4.0.0-dev.0
  - profile: 1.1.0
  - provisioning_api: 1.22.0
  - recommendations: 5.0.0-dev.0
  - related_resources: 3.0.0-dev.0
  - serverinfo: 4.0.0-dev.0
  - settings: 1.15.1
  - sharebymail: 1.22.0
  - systemtags: 1.22.0
  - text: 6.0.0-dev.0
  - theming: 2.7.0
  - twofactor_backupcodes: 1.21.0
  - twofactor_totp: 14.0.0
  - updatenotification: 1.22.0
  - user_status: 1.12.0
  - viewer: 5.0.0-dev.0
  - webhook_listeners: 1.3.0
  - workflowengine: 2.14.0
Disabled:
  - app_api: 32.0.0 (installed 32.0.0)
  - encryption: 2.20.0
  - federation: 1.22.0 (installed 1.8.0)
  - files_external: 1.24.0
  - firstrunwizard: 5.0.0-dev.0 (installed 2.7.0)
  - support: 4.0.0-dev.0 (installed 1.1.0)
  - survey_client: 4.0.0-dev.0 (installed 1.3.0)
  - suspicious_login: 10.0.0-dev.0
  - twofactor_nextcloud_notification: 6.0.0-dev.0
  - user_ldap: 1.23.0
  - weather_status: 1.12.0 (installed 1.9.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{
  "reqId": "Z3Yq0vtwC0j8legXOVPK",
  "level": 3,
  "time": "2025-10-15T12:13:11+00:00",
  "remoteAddr": "82.64.158.163",
  "user": "***REMOVED SENSITIVE VALUE***",
  "app": "no app in context",
  "method": "DELETE",
  "url": "/ocs/v2.php/apps/files_sharing/api/v1/shares/521?format=json",
  "message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
  "userAgent": "Mozilla/5.0 (Macintosh) mirall/3.17.3 (Nextcloud, macos-25.0.0 ClientArchitecture: arm64 OsArchitecture: arm64)",
  "version": "32.0.0.13",
  "clientReqId": "***REMOVED SENSITIVE VALUE***",
  "exception": {
    "Exception": "Exception",
    "Message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 153,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
          },
          "deleteShare"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 321,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "deleteShare",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "ocs.files_sharing.shareapi.deleteshare",
            "id": "521"
          }
        ]
      },
      {
        "file": "/var/www/html/ocs/v1.php",
        "line": 61,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/ocsapp/apps/files_sharing/api/v1/shares/521"
        ]
      },
      {
        "file": "/var/www/html/ocs/v2.php",
        "line": 8,
        "args": [
          "/var/www/html/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 150,
    "Previous": {
      "Exception": "Error",
      "Message": "Undefined constant OCP\\Share::SHARE_TYPE_USER",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/legacy/OC_Hook.php",
          "line": 85,
          "function": "preUnShare",
          "class": "OCA\\Maps\\Hooks\\FileHooks",
          "type": "->",
          "args": [
            {
              "id": "521",
              "itemType": "file",
              "itemSource": 12732,
              "shareType": 3,
              "shareWith": "",
              "itemparent": null,
              "uidOwner": "***REMOVED SENSITIVE VALUE***",
              "fileSource": 12732,
              "fileTarget": "/Anfrageformular.pdf"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/LegacyHooks.php",
          "line": 47,
          "function": "emit",
          "class": "OC_Hook",
          "type": "::",
          "args": [
            "OCP\\Share",
            "pre_unshare",
            {
              "id": "521",
              "itemType": "file",
              "itemSource": 12732,
              "shareType": 3,
              "shareWith": "",
              "itemparent": null,
              "uidOwner": "***REMOVED SENSITIVE VALUE***",
              "fileSource": 12732,
              "fileTarget": "/Anfrageformular.pdf"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/LegacyHooks.php",
          "line": 27,
          "function": "preUnshare",
          "class": "OC\\Share20\\LegacyHooks",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 220,
          "function": "OC\\Share20\\{closure}",
          "class": "OC\\Share20\\LegacyHooks",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php",
          "line": 56,
          "function": "callListeners",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            [
              {
                "__class__": "Closure"
              },
              {
                "__class__": "Closure"
              }
            ],
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 67,
          "function": "dispatch",
          "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/EventDispatcher/EventDispatcher.php",
          "line": 79,
          "function": "dispatch",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/Manager.php",
          "line": 2069,
          "function": "dispatchTyped",
          "class": "OC\\EventDispatcher\\EventDispatcher",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Share20/Manager.php",
          "line": 1135,
          "function": "dispatchEvent",
          "class": "OC\\Share20\\Manager",
          "type": "->",
          "args": [
            "*** sensitive parameters replaced ***",
            "before share deleted"
          ]
        },
        {
          "file": "/var/www/html/apps/files_sharing/lib/Controller/ShareAPIController.php",
          "line": 563,
          "function": "deleteShare",
          "class": "OC\\Share20\\Manager",
          "type": "->",
          "args": [
            {
              "__class__": "OC\\Share20\\Share"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 204,
          "function": "deleteShare",
          "class": "OCA\\Files_Sharing\\Controller\\ShareAPIController",
          "type": "->",
          "args": [
            "521"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 118,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
            },
            "deleteShare"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 153,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              "__class__": "OCA\\Files_Sharing\\Controller\\ShareAPIController"
            },
            "deleteShare"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 321,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Files_Sharing\\Controller\\ShareAPIController",
            "deleteShare",
            {
              "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "_route": "ocs.files_sharing.shareapi.deleteshare",
              "id": "521"
            }
          ]
        },
        {
          "file": "/var/www/html/ocs/v1.php",
          "line": 61,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/ocsapp/apps/files_sharing/api/v1/shares/521"
          ]
        },
        {
          "file": "/var/www/html/ocs/v2.php",
          "line": 8,
          "args": [
            "/var/www/html/ocs/v1.php"
          ],
          "function": "require_once"
        }
      ],
      "File": "/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php",
      "Line": 154
    },
    "message": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154",
    "exception": [],
    "CustomMessage": "Undefined constant OCP\\Share::SHARE_TYPE_USER in file '/var/www/html/custom_apps/maps/lib/Hooks/FileHooks.php' line 154"
  },
  "id": "68ef8fdc67403"
}

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap32-feedbackbug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions