nextcloud/workflow_script

An unhandled exception has been thrown: Error: Call to a member function getUID() on null nextcloud/apps/workflow_script/lib/Operation.php:318

BlablaBloblo opened this issue · 3 comments

Steps to reproduce

  1. Enabled external storage for group -> no owner for some items

Expected behaviour

No Crash ;)

Actual behaviour

while regular nextcloud cron:

An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /home/www-data/nextcloud/apps/workflow_script/lib/Operation.php:318
Stack trace:
#0 /home/www-data/nextcloud/apps/workflow_script/lib/Operation.php(203): OCA\WorkflowScript\Operation->replacePlaceholderN()
.........

Suggested solution:

replace:

if (strpos($node->getPath(), $owner->getUID()) !== 0) {

by:

if ($owner && (strpos($node->getPath(), $owner->getUID()) !== 0)) {

Hi @BlablaBloblo:

Thanks for the report!

You didn't specify the versions of this app and groupfolders/etc, but this should have been addressed (mostly) by nextcloud/groupfolders#797 (I think).

We could maybe add some deeper error handling up a bit higher:

$owner = $node->getOwner();

But the real issue is that $node->getOwner() should never have a situation where it can end up being null (regardless of in-use Storage or Groups).

Can you still reproduce this behavior today on any supported release?

Sorry, I changed the link to the external storage to work around the issue and cannot remember how it was before - it's 3 years ago at last. Thank you very much for coming back to this issue!

blizzz commented

Closing due to the latest feedback. We can re-evaluate if someone stumbles over it again.