humhub icon indicating copy to clipboard operation
humhub copied to clipboard

NotifySpacesMembers not proper path?

Open rafal-lowiec-hatz opened this issue 7 months ago • 4 comments

What steps will reproduce the problem?

I had this issue come up after the update to HumHub 1.15.0. You need to have an row inside notification table thats looks something like that:

... class ... user_id ... desktop_notified
... humhub\modules\mass_notification\notifications\NotifySpacesMembers ... [user id who logs in] ... 0

Now login with the user id specified within that row. I hope that this will reproduce the issue

What is the expected result?

After the login the user should see the dashboard.

What do you get instead?

A blank page with the following message: An internal server error occurred.

Additional info

Q A
HumHub version 1.15.0
PHP version 7.4.30
Operating system Linux INTRANET 4.19.0-20-amd64 #1 SMP Debian 4.19.235-1 (2022-03-17) x86_64

Error Log

Error: Call to a member function validate() on null in /var/www/humhub/protected/humhub/modules/notification/controllers/ListController.php:121 Stack trace: #0 /var/www/humhub/protected/humhub/modules/notification/widgets/Overview.php(67): humhub\modules\notification\controllers\ListController::getUpdates() #1 /var/www/humhub/protected/humhub/widgets/JsWidget.php(98): humhub\modules\notification\widgets\Overview->getData() #2 /var/www/humhub/protected/humhub/modules/notification/widgets/Overview.php(52): humhub\widgets\JsWidget->getOptions() #3 /var/www/humhub/protected/humhub/components/Widget.php(63): humhub\modules\notification\widgets\Overview->run() #4 /var/www/humhub/protected/humhub/widgets/BaseStack.php(88): humhub\components\Widget::widget() #5 /var/www/humhub/protected/humhub/components/Widget.php(63): humhub\widgets\BaseStack->run() #6 /var/www/humhub/protected/humhub/views/layouts/main.php(32): humhub\components\Widget::widget() #7 /var/www/humhub/protected/vendor/yiisoft/yii2/base/View.php(347): require('/var/www/humhub...') #8 /var/www/humhub/protected/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile() #9 /var/www/humhub/protected/humhub/components/Controller.php(155): yii\base\View->renderFile() #10 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(408): humhub\components\Controller->renderContent() #11 /var/www/humhub/protected/humhub/modules/dashboard/controllers/DashboardController.php(81): yii\base\Controller->render() #12 [internal function]: humhub\modules\dashboard\controllers\DashboardController->actionIndex() #13 /var/www/humhub/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #14 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams() #15 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction() #16 /var/www/humhub/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction() #17 /var/www/humhub/protected/vendor/yiisoft/yii2/base/Application.php(384): yii\web\Application->handleRequest() #18 /var/www/humhub/index.php(25): yii\base\Application->run() #19 {main}

I did some digging and actually found a solution that worked for me. But I had to edit a core file and that gets overwritten in the next update.

I did execute the following query: SELECT DISTINCT class FROM notification ORDER BY class;

That query gave me like 15 entries and i checked whether i was able to find the path. Everything existed except for humhub\modules\mass_notification\notifications\NotifySpacesMembers. All the others were present in PathToRootFolder\protected\humhub\modules\ ...

Through the IDE i could find the Reference to the NotifySpaceMembers Class it was in: PathToRootFolder/protected/runtime/module_backups/mass_notification_1700139323/notifications/NotifySpacesMembers.php

So i included the file after the use statements in PathToRootFolder/protected/humhub/modules/notification/models/Notification.php: $pathToNotifySpacesMembers = DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'runtime' . DIRECTORY_SEPARATOR . 'module_backups' . DIRECTORY_SEPARATOR . 'mass_notification_1700139323' . DIRECTORY_SEPARATOR . 'notifications' . DIRECTORY_SEPARATOR . 'NotifySpacesMembers.php'; if (file_exists($pathToNotifySpacesMembers)) { include_once($pathToNotifySpacesMembers); }

After that the problem was solved. But as already said. This is just a temporary solution and not really proper in my honest opinon.

rafal-lowiec-hatz avatar Nov 28 '23 12:11 rafal-lowiec-hatz

PHP 7.4 was dropped in v1.15

https://docs.humhub.org/docs/admin/requirements#php-environment

Also this is a custom module by @marc-farre

ArchBlood avatar Nov 28 '23 12:11 ArchBlood

@rafal-lowiec-hatz could you do the following things:

  • Upgrade your server to PHP 8.1 or 8.2 (including for cron jobs)
  • Check that your Mass Notification module is at the latest version (1.6.2)
  • Check the integrity of your DB: cd path-to-your-humhub/protect; php yii integrity/run; (see https://docs.humhub.org/docs/admin/console/#integrity)

If the problem remains, can you make a support request on https://www.cuzy.app/support/ with the link to this issue?

marc-farre avatar Nov 28 '23 12:11 marc-farre

@ArchBlood OK, that was an error on our part for not looking for the requirements. It would have been really cool humhub would have denied the update itself because of our php version. We did the update through the website.

@marc-farre

  1. Upgrading to 8.2 ... didnt resolve the issue.
  2. Our Version of the module is 1.5.4 ... this might be the core of this issue
  3. Doing the integrity check showed lots of entries with ... Deleting notification id someIdHere without valid class! (yes|no) [no]: (which would basic remove all the entries that are faulty)

Regarding point 2: i'd need to talk with my supervisor since this costs something.

Regarding point 3: I dont know how the rows got there. Deleting the faulty rows might be an option for now. But the next mass notification might trigger the problem again.

Thank you both for your quick responses.

rafal-lowiec-hatz avatar Nov 28 '23 13:11 rafal-lowiec-hatz

It would have been really cool humhub would have denied the update itself because of our php version.

Was your "Updater" module updated? Because since version 2.1.11 the PHP version is checked, see https://marketplace.humhub.com/module/updater/changelog and https://github.com/humhub/updater/issues/20

Our Version of the module is 1.5.4 ... this might be the core of this issue

I cannot tell. But if you have a valid license key, you can first update the module and if the error remains you can send a support request and I'll solve the problem (maybe we'll need a video call to understand what's happening on your Humhub instance).

Deleting the faulty rows might be an option for now.

Not sure it will resolve your problem, but it might, and in all cases you should remove them.

marc-farre avatar Nov 29 '23 08:11 marc-farre