Skip to content

Cannot assign null to property OCA\Polls\Model\User\User::$user #2944

@xylo

Description

@xylo

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • I agree to follow Nextcloud's Code of Conduct.

What went wrong, what did you observe?

The bug occurs when I try to share a poll with Nextcloud users, e.g. it happens when I enter any text in the input field for searching for users to share the poll with. On the server an exception is thrown and the webbrowser shows always an empty list of user suggestions.

What did you expect, how polls should behave instead?

When I search for a user to share my poll with I expect the poll app to behave exactly like the share function for files, e.g. it should return a list of matching users for my input.

What steps does it need to replay this bug?

  1. Create a poll.
  2. Go to the share tab.
  3. Input any text in the input field.
  4. Look into the Nextcloud log and see the exception.

Installation method

Installed/updated using occ

Installation type

Updated from previous major version (i.e. 3.x.x to 4.x.x)

Affected polls version

5.0.5

Which browser did you use, when experiencing the bug?

  • Firefox
  • Chrome
  • Chromium/Chromium based (i.e. Edge)
  • Safari
  • Other/Don't know

Other browser

No response

Which System did you use, when experiencing the bug?

  • Windows
  • Linux
  • MacOs
  • iOS
  • Android
  • Other/Don't know

Other OS

No response

Add your browser log here

No response

Additional client environment information

No response

NC version

Nextcloud 25 (Nextcloud Hub 3)

Other Nextcloud version

25.0.7

PHP engine version

PHP 7.3

Other PHP version

8.1.18

Database engine

MariaDB

Database Engine version or other Database

10.5.19

Which user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other/Don't know

Add your nextcloud server log here

[index] Fehler: Exception: Cannot assign null to property OCA\Polls\Model\User\User::$user of type OCP\IUser in file '[...]/apps/polls/lib/Model/User/User.php' line 52 at <<closure>>

0. /var/www/nextcloud/iat/lib/private/AppFramework/App.php line 172
   OC\AppFramework\Http\Dispatcher->dispatch()
1. /var/www/nextcloud/iat/lib/private/Route/Router.php line 298
   OC\AppFramework\App::main()
2. /var/www/nextcloud/iat/lib/base.php line 1048
   OC\Route\Router->match()
3. /var/www/nextcloud/iat/index.php line 36
   OC::handleRequest()

GET /index.php/apps/polls/search/users/e

Additional environment informations

Exception as JSON:

{
	"reqId": "[...]",
	"level": 3,
	"time": "2023-06-12T09:32:51+00:00",
	"remoteAddr": "[...]",
	"user": "[...]",
	"app": "index",
	"method": "GET",
	"url": "/index.php/apps/polls/search/users/e",
	"message": "Cannot assign null to property OCA\\Polls\\Model\\User\\User::$user of type OCP\\IUser in file '[...]/apps/polls/lib/Model/User/User.php' line 52",
	"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
	"version": "25.0.7.1",
	"exception": {
		"Exception": "Exception",
		"Message": "Cannot assign null to property OCA\\Polls\\Model\\User\\User::$user of type OCP\\IUser in file '[...]/apps/polls/lib/Model/User/User.php' line 52",
		"Code": 0,
		"Trace": [
			{
				"file": "[...]/lib/private/AppFramework/App.php",
				"line": 172,
				"function": "dispatch",
				"class": "OC\\AppFramework\\Http\\Dispatcher",
				"type": "->"
			},
			{
				"file": "[...]/lib/private/Route/Router.php",
				"line": 298,
				"function": "main",
				"class": "OC\\AppFramework\\App",
				"type": "::"
			},
			{
				"file": "[...]/lib/base.php",
				"line": 1048,
				"function": "match",
				"class": "OC\\Route\\Router",
				"type": "->"
			},
			{
				"file": "[...]/index.php",
				"line": 36,
				"function": "handleRequest",
				"class": "OC",
				"type": "::"
			}
		],
		"File": "[...]/lib/private/AppFramework/Http/Dispatcher.php",
		"Line": 165,
		"Previous": {
			"Exception": "TypeError",
			"Message": "Cannot assign null to property OCA\\Polls\\Model\\User\\User::$user of type OCP\\IUser",
			"Code": 0,
			"Trace": [
				{
					"file": "[...]/apps/polls/lib/Service/UserService.php",
					"line": 163,
					"function": "__construct",
					"class": "OCA\\Polls\\Model\\User\\User",
					"type": "->"
				},
				{
					"file": "[...]/apps/polls/lib/Service/SystemService.php",
					"line": 122,
					"function": "search",
					"class": "OCA\\Polls\\Service\\UserService",
					"type": "->"
				},
				{
					"file": "[...]/apps/polls/lib/Controller/SystemController.php",
					"line": 48,
					"function": "getSiteUsersAndGroups",
					"class": "OCA\\Polls\\Service\\SystemService",
					"type": "->"
				},
				{
					"file": "[...]/lib/private/AppFramework/Http/Dispatcher.php",
					"line": 225,
					"function": "userSearch",
					"class": "OCA\\Polls\\Controller\\SystemController",
					"type": "->"
				},
				{
					"file": "[...]/lib/private/AppFramework/Http/Dispatcher.php",
					"line": 133,
					"function": "executeController",
					"class": "OC\\AppFramework\\Http\\Dispatcher",
					"type": "->"
				},
				{
					"file": "[...]/lib/private/AppFramework/App.php",
					"line": 172,
					"function": "dispatch",
					"class": "OC\\AppFramework\\Http\\Dispatcher",
					"type": "->"
				},
				{
					"file": "[...]/lib/private/Route/Router.php",
					"line": 298,
					"function": "main",
					"class": "OC\\AppFramework\\App",
					"type": "::"
				},
				{
					"file": "[...]/lib/base.php",
					"line": 1048,
					"function": "match",
					"class": "OC\\Route\\Router",
					"type": "->"
				},
				{
					"file": "[...]/index.php",
					"line": 36,
					"function": "handleRequest",
					"class": "OC",
					"type": "::"
				}
			],
			"File": "[...]/apps/polls/lib/Model/User/User.php",
			"Line": 52
		},
		"CustomMessage": "--"
	},
	"id": "[...]"
}

Configuration report

{
    "system": {
        "trusted_domains": [
            "[...]",
            "[...]"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/[...].de",
        "dbtype": "mysql",
        "version": "25.0.7.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "default_language": "de_DE",
        "maintenance": false,
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0
        },
        "mail_smtpmode": "sendmail",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "updatechecker": true,
        "appstoreenabled": true,
        "appstore.experimental.enabled": false,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 1,
        "trashbin_retention_obligation": "auto",
        "proxy": "192.168.201.1:8000",
        "proxyexclude": [
            "127.0.0.1",
            "192.168.201.*",
            "[...]",
            "[...]",
            "[...]",
            "[...]"
        ],
        "allow_local_remote_servers": true,
        "updater.release.channel": "stable",
        "theme": "[...]",
        "tempdirectory": "\/var\/lib\/nextcloud\/tmp",
        "mail_sendmailmode": "pipe",
        "mysql.utf8mb4": true,
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "default_locale": "de_DE",
        "default_phone_region": "DE",
        "has_rebuilt_cache": true
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - announcementcenter: 6.6.1
  - bookmarks: 12.1.0
  - bruteforcesettings: 2.5.0
  - calendar: 4.3.5
  - carnet: 0.24.7
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.3.0
  - contactsinteraction: 1.6.0
  - cospend: 1.5.8
  - dav: 1.24.0
  - deck: 1.8.5
  - drawio: 2.1.1
  - end_to_end_encryption: 1.11.4
  - external: 5.0.2
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_external: 1.17.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
  - forms: 3.3.0
  - groupfolders: 13.1.3
  - impersonate: 1.12.1
  - integration_openproject: 2.3.7
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - maps: 1.0.2
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - photos: 2.0.1
  - polls: 5.0.5
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - spreed: 15.0.6
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - tasks: 0.15.0
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_admin: 4.1.9
  - twofactor_backupcodes: 1.14.0
  - twofactor_totp: 7.0.0
  - updatenotification: 1.15.0
  - user_ldap: 1.15.0
  - user_status: 1.5.0
  - user_usage_report: 1.10.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - dashboard: 7.0.0
  - encryption
  - files_markdown: 2.4.0
  - files_pdfviewer: 0.7
  - files_texteditor: 2.15.0
  - openotp_auth: 1.5.0
  - richdocuments: 7.1.4
  - richdocumentscode: 22.5.1301
  - suspicious_login
  - workflow_media_converter: 1.8.4

Nextcloud Signing status

No errors have been found.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions