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

Nextcloud 15.0.1 upgrade error #13499

Closed
mightyBroccoli opened this issue Jan 10, 2019 · 21 comments
Closed

Nextcloud 15.0.1 upgrade error #13499

mightyBroccoli opened this issue Jan 10, 2019 · 21 comments
Labels
3. to review Waiting for reviews bug high

Comments

@mightyBroccoli
Copy link

The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see http://php.net/manual/en/book.pcntl.php
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Updating <dav> ...
Fix broken values of calendar objects

 Done
    0/0 [>---------------------------]   0%
An unhandled exception has been thrown:
TypeError: Argument 1 passed to OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null given, called in /var/www/example.tld/cloud.example.tld/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php on line 108 and defined in /var/www/example.tld/cloud.example.tld/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:120
Stack trace:
#0 /var/www/example.tld/cloud.example.tld/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(108): OCA\DAV\Migration\RemoveClassifiedEventActivity->getPrincipal(NULL)
#1 /var/www/example.tld/cloud.example.tld/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(55): OCA\DAV\Migration\RemoveClassifiedEventActivity->removeConfidentialUncensoredEventActivity()
#2 /var/www/example.tld/cloud.example.tld/lib/private/Repair.php(96): OCA\DAV\Migration\RemoveClassifiedEventActivity->run(Object(OC\Repair))
#3 /var/www/example.tld/cloud.example.tld/lib/private/legacy/app.php(966): OC\Repair->run()
#4 /var/www/example.tld/cloud.example.tld/lib/private/legacy/app.php(903): OC_App::executeRepairSteps('dav', Array)
#5 /var/www/example.tld/cloud.example.tld/lib/private/Updater.php(365): OC_App::updateApp('dav')
#6 /var/www/example.tld/cloud.example.tld/lib/private/Updater.php(245): OC\Updater->doAppUpgrade()
#7 /var/www/example.tld/cloud.example.tld/lib/private/Updater.php(121): OC\Updater->doUpgrade('15.0.1.2', '15.0.0.10')
#8 /var/www/example.tld/cloud.example.tld/core/Command/Upgrade.php(258): OC\Updater->upgrade()
#9 /var/www/example.tld/cloud.example.tld/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/example.tld/cloud.example.tld/3rdparty/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/example.tld/cloud.example.tld/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/example.tld/cloud.example.tld/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/example.tld/cloud.example.tld/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/example.tld/cloud.example.tld/console.php(96): OC\Console\Application->run()
#15 /var/www/example.tld/cloud.example.tld/occ(11): require_once('/var/www/magicb...')

Steps to reproduce

  1. upgrade from 15 to 15.0.1

Expected behaviour

Upgrade should run proṕerly

Actual behaviour

This error appeared.

Server configuration

Operating system:
Debian 9.6

Web server:
nginx

Database:
MariaDB - 10.1.37-0+deb9u1

PHP version:
7.0.33-1

Nextcloud version: (see Nextcloud admin page)
15.0.0

Updated from an older Nextcloud/ownCloud or fresh install:
upgraded all steps until today

Where did you install Nextcloud from:
website

List of activated apps:

App list Enabled: - accessibility: 1.1.0 - activity: 2.8.2 - admin_audit: 1.5.0 - announcementcenter: 3.4.0 - calendar: 1.6.4 - cloud_federation_api: 0.1.0 - comments: 1.5.0 - contacts: 3.0.1 - data_request: 1.2.0 - dav: 1.8.0 - federatedfilesharing: 1.5.0 - federation: 1.5.0 - files: 1.10.0 - files_accesscontrol: 1.5.0 - files_external: 1.6.0 - files_markdown: 2.0.5 - files_pdfviewer: 1.4.0 - files_retention: 1.4.0 - files_sharing: 1.7.0 - files_texteditor: 2.7.0 - files_trashbin: 1.5.0 - files_versions: 1.8.0 - firstrunwizard: 2.4.0 - gallery: 18.2.0 - groupfolders: 2.0.2 - impersonate: 1.2.0 - logreader: 2.0.0 - lookup_server_connector: 1.3.0 - nextcloud_announcements: 1.4.0 - notifications: 2.3.0 - oauth2: 1.3.0 - password_policy: 1.5.0 - polls: 0.9.5 - provisioning_api: 1.5.0 - quota_warning: 1.4.0 - ransomware_protection: 1.3.0 - serverinfo: 1.5.0 - sharebymail: 1.5.0 - support: 1.0.0 - systemtags: 1.5.0 - tasks: 0.9.8 - theming: 1.6.0 - twofactor_backupcodes: 1.4.1 - twofactor_nextcloud_notification: 1.0.2 - twofactor_totp: 2.1.0 - twofactor_u2f: 2.1.0 - updatenotification: 1.5.0 - workflowengine: 1.5.0 Disabled: - encryption - files_rightclick - files_videoplayer - socialsharing_email - survey_client - user_external - user_ldap

Nextcloud configuration:

Config report { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "cloud.example.tld", "www.cloud.example.tld" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "version": "15.0.0.10", "installed": true, "cipher": "AES-256-CFB", "dbtype": "mysql", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "mysql.utf8mb4": true, "default_language": "de", "defaultapp": "files", "enable_avatars": true, "allow_user_to_change_display_name": true, "updater.release.channel": "stable", "upgrade.disable-web": false, "check_for_working_webdav": true, "htaccess.RewriteBase": "\/", "trashbin_retention_obligation": "auto, 60", "versions_retention_obligation": "auto", "activity_expire_days": 90, "filesystem_check_changes": 0, "theme": "", "maintenance": true, "singleuser": false, "data-fingerprint": "16b42c01070fc24c2086fb974eda1d16", "overwriteprotocol": "https", "overwrite.cli.url": "https:\/\/cloud.example.tld", "mail_smtpmode": "smtp", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpauth": 1, "mail_smtpauthtype": "LOGIN", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "587", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "tls", "logdateformat": "d.m.Y - H:i:s", "logtimezone": "Europe\/Berlin", "log_rotate_size": false, "loglevel": 0, "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "filelocking.enabled": "true", "memcache.local": "\\OC\\Memcache\\APCu", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "dbindex": 1, "port": 0, "timeout": 1.5 }, "enable_previews": true, "preview_max_x": 1024, "preview_max_y": 1024, "preview_max_scale_factor": 1, "enabledPreviewProviders": [ "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\BMP", "OC\\Preview\\XBitmap", "OC\\Preview\\MP3", "OC\\Preview\\TXT", "OC\\Preview\\MarkDown" ], "sharing.minSearchStringLength": 3, "updater.secret": "***REMOVED SENSITIVE VALUE***" } }

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

@mightyBroccoli mightyBroccoli added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jan 10, 2019
@edo0
Copy link

edo0 commented Jan 10, 2019

I had the very same issue, in the same circumstances (15.0 always updated with online installer), and this was my output
`Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Updating ...
Fix broken values of calendar objects

Done
0/0 [>---------------------------] 0%
An unhandled exception has been thrown:
TypeError: Argument 1 passed to OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null given, called in /var/www/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php on line 78 and defined in /var/www/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:120
Stack trace:
#0 /var/www/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(78): OCA\DAV\Migration\RemoveClassifiedEventActivity->getPrincipal(NULL)
#1 /var/www/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(54): OCA\DAV\Migration\RemoveClassifiedEventActivity->removePrivateEventActivity()
#2 /var/www/nextcloud/lib/private/Repair.php(96): OCA\DAV\Migration\RemoveClassifiedEventActivity->run(Object(OC\Repair))
#3 /var/www/nextcloud/lib/private/legacy/app.php(966): OC\Repair->run()
#4 /var/www/nextcloud/lib/private/legacy/app.php(903): OC_App::executeRepairSteps('dav', Array)
#5 /var/www/nextcloud/lib/private/Updater.php(365): OC_App::updateApp('dav')
#6 /var/www/nextcloud/lib/private/Updater.php(245): OC\Updater->doAppUpgrade()
#7 /var/www/nextcloud/lib/private/Updater.php(121): OC\Updater->doUpgrade('15.0.1.2', '15.0.0.10')
#8 /var/www/nextcloud/core/Command/Upgrade.php(258): OC\Updater->upgrade()
#9 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/nextcloud/console.php(96): OC\Console\Application->run()
#15 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#16 {main}root@host:~# `

@edo0
Copy link

edo0 commented Jan 11, 2019

@mightyBroccoli Were you able to find any fix or workaround for this issue?
I am no web development expert, and am in urgent need to get my NC instance back to work.
Thanks!

@nuttysquirrel
Copy link

For what its worth, this seems to happen for 14.0.4 -> 14.0.5 also..
`# sudo -u apache ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Updating ...
Fix broken values of calendar objects

Done
0/0 [>---------------------------] 0%
An unhandled exception has been thrown:
TypeError: Return value of OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null returned in /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:122
Stack trace:
#0 /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(78): OCA\DAV\Migration\RemoveClassifiedEventActivity->getPrincipal('principals/quen...')
#1 /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(54): OCA\DAV\Migration\RemoveClassifiedEventActivity->removePrivateEventActivity()
#2 /usr/share/nextcloud/lib/private/Repair.php(89): OCA\DAV\Migration\RemoveClassifiedEventActivity->run(Object(OC\Repair))
#3 /usr/share/nextcloud/lib/private/legacy/app.php(966): OC\Repair->run()
#4 /usr/share/nextcloud/lib/private/legacy/app.php(903): OC_App::executeRepairSteps('dav', Array)
#5 /usr/share/nextcloud/lib/private/Updater.php(365): OC_App::updateApp('dav')
#6 /usr/share/nextcloud/lib/private/Updater.php(245): OC\Updater->doAppUpgrade()
#7 /usr/share/nextcloud/lib/private/Updater.php(121): OC\Updater->doUpgrade('14.0.5.2', '14.0.4.2')
#8 /usr/share/nextcloud/core/Command/Upgrade.php(258): OC\Updater->upgrade()
#9 /usr/share/nextcloud/3rdparty/symfony/console/Command/Command.php(251): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /usr/share/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /usr/share/nextcloud/console.php(96): OC\Console\Application->run()
#15 /usr/share/nextcloud/occ(11): require_once('/usr/share/next...')
#16 {main}`

updated using the updater.phar cli tool, with no issues reported up until that point.

@go2sh
Copy link
Contributor

go2sh commented Jan 11, 2019

There might be a but in the code introduced by #13439. Maybe you could try to replace principaluri with c.principaluri in line 78 and 108. It is also backported to 14 and 13, I think. So all versions are affected.

@nuttysquirrel
Copy link

updated /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php lines 78 and 108 as mentioned...

TypeError: Argument 1 passed to OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null given, called in /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php on line 78 and defined in /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:120

@MorrisJobke
Copy link
Member

Thanks - we are looking into it - we stopped the updater for now

@MorrisJobke MorrisJobke added this to the Nextcloud 15.0.2 milestone Jan 11, 2019
@ChristophWurst ChristophWurst added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jan 11, 2019
@nuttysquirrel
Copy link

nuttysquirrel commented Jan 11, 2019

I guess no-op'ing the loop at line 78 is a reasonable bandaid until we figure out what is going on?

(for me, it means the difference between a broken nextcloud, and one that responds!)

                while ($row = $result->fetch()) {
                        #$delete->setParameter('owner', $this->getPrincipal($row['c.principaluri']))
                                #->setParameter('type', 'calendar')
                                #->setParameter('calendar_id', $row['calendarid'])
                                #->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%');
                        #$deletedEvents += $delete->execute();
                }

@nickvergessen
Copy link
Member

Urgh, this error basically means you have events which don't have a calendar anymore :/

@rullzer
Copy link
Member

rullzer commented Jan 11, 2019

ah so diffeernt than what I tought
well so be it. Let me update my patch then.

@ChristophWurst
Copy link
Member

You can find the PR here: #13503
And the patch as a quick fix to proceed with the update: https://patch-diff.githubusercontent.com/raw/nextcloud/server/pull/13503.patch

@ChristophWurst ChristophWurst added 3. to review Waiting for reviews and removed 1. to develop Accepted and waiting to be taken care of labels Jan 11, 2019
@MorrisJobke
Copy link
Member

Fix is in #13503

@edo0
Copy link

edo0 commented Jan 11, 2019

Forgive my ignorance, how can I apply the fix to my installation, so as to proceed with the upgrade and restore function?

@go2sh
Copy link
Contributor

go2sh commented Jan 11, 2019

Download the file in #13503 and replace it.

@ChristophWurst
Copy link
Member

@edo0
Copy link

edo0 commented Jan 11, 2019

Thank you!!!
Everything went smoothly

@nuttysquirrel
Copy link

FYI: patch applied and then ran;
./occ maintenance:repair
[other good words removed]

  • Remove activity entries of private events
    An unhandled exception has been thrown:
    TypeError: Return value of OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null returned in /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:128

it's referring to this function:
protected function getPrincipal(string $principalUri): string {
$uri = explode('/', $principalUri);
return $uri[2];
}

no big deal, but just through you guys might like to know.

@nickvergessen
Copy link
Member

Install 15.0.2 and run the update there. Then it should work fine

@nuttysquirrel
Copy link

nuttysquirrel commented Jan 12, 2019

previous comment was after upgrading from 14.0.5 to 14.0.6, and then running the maintenance:repair.

just upgraded to 15.0.2, still seeing the same error... fyi:

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Enable maintenance mode
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
[snip]
Fix broken values of calendar objects

 Starting ...
    0/0 [>---------------------------]   0%
An unhandled exception has been thrown:
TypeError: Return value of OCA\DAV\Migration\RemoveClassifiedEventActivity::getPrincipal() must be of the type string, null returned in /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php:130
Stack trace:
#0 /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(82): OCA\DAV\Migration\RemoveClassifiedEventActivity->getPrincipal('principals/quen...')
#1 /usr/share/nextcloud/apps/dav/lib/Migration/RemoveClassifiedEventActivity.php(54): OCA\DAV\Migration\RemoveClassifiedEventActivity->removePrivateEventActivity()
#2 /usr/share/nextcloud/lib/private/Repair.php(96): OCA\DAV\Migration\RemoveClassifiedEventActivity->run(Object(OC\Repair))
#3 /usr/share/nextcloud/lib/private/legacy/app.php(966): OC\Repair->run()
#4 /usr/share/nextcloud/lib/private/legacy/app.php(903): OC_App::executeRepairSteps('dav', Array)
#5 /usr/share/nextcloud/lib/private/Updater.php(365): OC_App::updateApp('dav')
#6 /usr/share/nextcloud/lib/private/Updater.php(245): OC\Updater->doAppUpgrade()
#7 /usr/share/nextcloud/lib/private/Updater.php(121): OC\Updater->doUpgrade('15.0.2.0', '14.0.6.0')
#8 /usr/share/nextcloud/core/Command/Upgrade.php(258): OC\Updater->upgrade()
#9 /usr/share/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(946): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /usr/share/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /usr/share/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /usr/share/nextcloud/console.php(96): OC\Console\Application->run()
#15 /usr/share/nextcloud/occ(11): require_once('/usr/share/next...')
#16 {main}

@nuttysquirrel
Copy link

so, to recap, currently the fix is;

                while ($row = $result->fetch()) {
                        if ($row['principaluri'] == null) {
                                continue;
                        }

                        $delete->setParameter('owner', $this->getPrincipal($row['principaluri']))
                                ->setParameter('type', 'calendar')
                                ->setParameter('calendar_id', $row['calendarid'])
                                ->setParameter('event_uid', '%' . $this->connection->escapeLikeParameter('{"id":"' . $row['uid'] . '"') . '%');
                        $deletedEvents += $delete->execute();
                }

Which includes a null check. However, the followup issue occurring is where $row['principaluri'] is not actually null, but not of the form we expect.
It seems like we make a few assumptions in getPrincipal about the structure of the passed string.

protected function getPrincipal(string $principalUri): string {
$uri = explode('/', $principalUri);
return $uri[2];
}

updating this to:

protected function getPrincipal(string $principalUri): string {
print "PRINCIPAL URI: ".$principalUri."\n";
                $uri = explode('/', $principalUri);
print "explode0 ".$uri[0]."\n";
print "explode1 ".$uri[1]."\n";
print "explode2 ".$uri[2]."\n";
                return $uri[2];

And we get the output:

PRINCIPAL URI: principals/myuser
explode[0] principals
explode[1] myuser
explode[2] 

hope this helps someone!

@nickvergessen
Copy link
Member

Can you try replacing:


with:

return array_pop($uri);

@nuttysquirrel
Copy link

ran through as expected. no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug high
Projects
None yet
Development

No branches or pull requests

8 participants