zteeed / dokuwiki-discord-notifier

Notify page events via Discord
https://www.dokuwiki.org/plugin:discordnotifier
7 stars 6 forks source link

Cannot access offset of type string on string #26

Open Miro-Collas opened 1 year ago

Miro-Collas commented 1 year ago

See https://prnt.sc/0dV0wG5s4fHC

I get this on a single page of our wiki (which is quite large) so that suggests something on the page is causing the problem. However, a search turned up this: https://laracasts.com/discuss/channels/general-discussion/error-after-update-php-73-to-81-cannot-access-offset-of-type-string-on-string

We do in fact use PHP8. So possibly something on the specific page is triggering the behavior described above.

2023-08-13 02:38:59TypeError: Cannot access offset of type string on string /home/fswiki/public_html/lib/plugins/discordnotifier/helper.php(113)
    #0 /home/fswiki/public_html/lib/plugins/discordnotifier/action.php(37): helper_plugin_discordnotifier->set_payload_text(Object(dokuwiki\Extension\Event))
    #1 /home/fswiki/public_html/inc/Extension/EventHandler.php(81): action_plugin_discordnotifier->_handle(Object(dokuwiki\Extension\Event), NULL)
    #2 /home/fswiki/public_html/inc/Extension/Event.php(96): dokuwiki\Extension\EventHandler->process_event(Object(dokuwiki\Extension\Event), 'AFTER')
    #3 /home/fswiki/public_html/inc/File/PageFile.php(194): dokuwiki\Extension\Event->advise_after()
    #4 /home/fswiki/public_html/inc/common.php(1269): dokuwiki\File\PageFile->saveWikiText('{{tag>downloads...', 'created', false)
    #5 /home/fswiki/public_html/inc/Action/Save.php(55): saveWikiText('fs_older_downlo...', '{{tag>downloads...', 'created', false)
    #6 /home/fswiki/public_html/inc/ActionRouter.php(83): dokuwiki\Action\Save->preProcess()
    #7 /home/fswiki/public_html/inc/ActionRouter.php(48): dokuwiki\ActionRouter->setupAction('save')
    #8 /home/fswiki/public_html/inc/ActionRouter.php(60): dokuwiki\ActionRouter->__construct()
    #9 /home/fswiki/public_html/inc/actions.php(16): dokuwiki\ActionRouter::getInstance(true)
    #10 /home/fswiki/public_html/doku.php(126): act_dispatch()
    #11 {main} 
yaynstuff commented 1 year ago

Chiming in here (projects sysadmin)

Despite dokuwiki saying we had the most current version of this plugin, it seems that helper.php in our case did not have this fix applied to it:

https://github.com/zteeed/dokuwiki-discord-notifier/commit/d01536c9ae7661e1fff2168dc51984fdff844cf4

I have manually applied this change however it does not resolve the problem, the error remains exactly the same.

Miro-Collas commented 1 year ago

This has since happened on a few other pages (we have a many page updates ongoing)

Miro-Collas commented 1 year ago

OK, very simple repro: create a new page, type "test" into the contents, save, and you get the error reported above. If you hit Back on your web browser, you can save. However, the page has actually been created, as you can see if you instead just load visit the page.