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

Error creating a wiki page #60

Closed
1 of 3 tasks
ovruni opened this issue Aug 12, 2023 · 6 comments
Closed
1 of 3 tasks

Error creating a wiki page #60

ovruni opened this issue Aug 12, 2023 · 6 comments

Comments

@ovruni
Copy link

ovruni commented Aug 12, 2023

This issue is:

  • Bug report
  • Feature request
  • Improvement

Actual behaviour

After clicking the save button when trying to create a wiki page no wiki page is created

Expected behaviour

A new wiki page is expected to be created

Steps to reproduce

Click on "New Wiki page", fill in "Title", "Content" and click "Save".

Screenshots

Logs

Fatal error: Uncaught TypeError: Symfony\Component\EventDispatcher\EventDispatcher::dispatch(): Argument #1 ($event) must be of type object, string given, called in /var/www/app/plugins/Wiki/Model/WikiEventJob.php on line 42 and defined in /var/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php:48 Stack trace: #0 /var/www/app/plugins/Wiki/Model/WikiEventJob.php(42): Symfony\Component\EventDispatcher\EventDispatcher->dispatch() #1 /var/www/app/plugins/Wiki/Model/Wiki.php(270): Kanboard\Plugin\Wiki\Model\WikiEventJob->execute() #2 /var/www/app/plugins/Wiki/Controller/WikiController.php(326): Kanboard\Plugin\Wiki\Model\Wiki->createpage() #3 /var/www/app/app/Core/Controller/Runner.php(77): Kanboard\Plugin\Wiki\Controller\WikiController->save() #4 /var/www/app/app/Core/Controller/Runner.php(31): Kanboard\Core\Controller\Runner->executeController() #5 /var/www/app/index.php(9): Kanboard\Core\Controller\Runner->execute() #6 {main} thrown in /var/www/app/vendor/symfony/event-dispatcher/EventDispatcher.php on line 48

Configuration

  • Kanboard version: 1.2.32
  • Plugin version: 0.3.2
  • Database type and version: Mariadb 10.5.19
  • PHP version: 7.4.33
  • OS: GNU/Linux
  • Browser: Firefox
  • Application settings Language: English
@ovruni
Copy link
Author

ovruni commented Aug 12, 2023

Synfony 4.3 has changed the signature of the EventDispatcherInterface::dispatch() method, changing the order of the parameters.

It is necessary to modify the dispatch method in https://github.com/funktechno/kanboard-plugin-wiki/blob/dev/Model/WikiEventJob.php

$this->dispatcher->dispatch($eventName, $event); to $this->dispatcher->dispatch($event, $eventName);

@alfredbuehler
Copy link
Collaborator

Yes, but to avoid breaking with earlier versions of Kanboard:

diff --git a/Model/WikiEventJob.php b/Model/WikiEventJob.php
index 5590cbc..3734cad 100644
--- a/Model/WikiEventJob.php
+++ b/Model/WikiEventJob.php
@@ -39,8 +39,11 @@ class WikiEventJob extends BaseJob
             ->buildEventWiki($wikiPage);
 
         if ($event !== null) {
-            $this->dispatcher->dispatch($eventName, $event);
-
+            if (APP_VERSION < '1.2.31') {
+                $this->dispatcher->dispatch($eventName,$event);
+            } else {
+                $this->dispatcher->dispatch($event, $eventName);
+            }
             // if ($eventName === Wiki::EVENT_CREATE) {
             //     $userMentionJob = $this->userMentionJob->withParams($event['comment']['comment'], Wiki::EVENT_USER_MENTION, $event);
             //     $this->queueManager->push($userMentionJob);

@RainerBielefeld
Copy link
Contributor

Seems I suffer from the same problem, see discourse forum "Update to 1.2.32: WIKI-plugin no longer works!"

@imfx77
Copy link
Contributor

imfx77 commented Dec 25, 2023

Yes, but to avoid breaking with earlier versions of Kanboard:

diff --git a/Model/WikiEventJob.php b/Model/WikiEventJob.php
index 5590cbc..3734cad 100644
--- a/Model/WikiEventJob.php
+++ b/Model/WikiEventJob.php
@@ -39,8 +39,11 @@ class WikiEventJob extends BaseJob
             ->buildEventWiki($wikiPage);
 
         if ($event !== null) {
-            $this->dispatcher->dispatch($eventName, $event);
-
+            if (APP_VERSION < '1.2.31') {
+                $this->dispatcher->dispatch($eventName,$event);
+            } else {
+                $this->dispatcher->dispatch($event, $eventName);
+            }
             // if ($eventName === Wiki::EVENT_CREATE) {
             //     $userMentionJob = $this->userMentionJob->withParams($event['comment']['comment'], Wiki::EVENT_USER_MENTION, $event);
             //     $this->queueManager->push($userMentionJob);

Seems a valid solution to both keep the backward compatibility and fix the new problem.
I don't see a pull request about it ... but is it really necessary when both the problem and the solution are known?
I guess many of us are up to date with Kanboard and keep those local plugin changes just so the Wiki works.
So? What is keeping an official fix from happening? Any contributor with push access?

Also, as I can see the symphony dependencies were actually updated in Kanboard v.1.2.31
So the correct check should be:
if (APP_VERSION <= '1.2.31')
or
if (APP_VERSION < '1.2.32')
Am I wrong?

@alfredbuehler
Copy link
Collaborator

You're wrong.

Also, as I can see the symphony dependencies were actually updated in Kanboard v.1.2.31

This means that the 31 was broken by the update.
So if (APP_VERSION < '1.2.31') is correct for running the old code.

@petersonespacoporto
Copy link

Thanks for describing how to fix the issue!

Additionally, you should change line 58 of the same file [the one related to "public function executeWithId"] if you want to be able to delete any page.

@lastlink lastlink mentioned this issue Jul 19, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants