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

Uncaught Error: [] operator not supported for strings #53

Open
tmo26 opened this issue Oct 27, 2021 · 0 comments
Open

Uncaught Error: [] operator not supported for strings #53

tmo26 opened this issue Oct 27, 2021 · 0 comments

Comments

@tmo26
Copy link

tmo26 commented Oct 27, 2021

I'm writing this down just in case someone is still using the pagequery plugin in combination with php 7.1+ and stumbles over the same issue.

The following issue is found in in the nginx error log, after accessing a page that has a pagequery in it with sorting by date (other pagequeries are not affected):

2021/10/27 14:42:12 [error] 806#806: *1158977 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/dokuwiki/lib/plugins/pagequery/inc/pagequery.php:787
Stack trace:
#0 /var/www/dokuwiki/lib/plugins/pagequery/inc/pagequery.php(609): PageQuery->_date_format()
#1 /var/www/dokuwiki/lib/plugins/pagequery/syntax.php(288): PageQuery->build_sorting_array()
#2 /var/www/dokuwiki/inc/parser/renderer.php(117): syntax_plugin_pagequery->render()
#3 /var/www/dokuwiki/inc/parserutils.php(673): Doku_Renderer->plugin()
#4 /var/www/dokuwiki/inc/parserutils.php(142): p_render()
#5 /var/www/dokuwiki/inc/parserutils.php(89): p_cached_output()
#6 /var/www/dokuwiki/inc/html.php(305): p_wiki_xhtml()
#7 /var/www/dokuwiki/inc/Action/Show.php(33): html_show()
#8 /var/www/dokuwiki/inc/template.php(99): dokuwiki\Action\Show->tplContent()
#9 [internal function]: tpl_content_core()
#10 /var/www/dokuwiki/inc/Extension/Event.php(129): call_user_func_array()
#11 /var/www/dokuwiki/inc/Extension/Event.php(195): dokuwiki\Extension\Event" while reading upstream, client: 66.249.76.229, server: openwrt.org, request: "GET /wiki/stats/created_pages HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.4-fpm.sock:", host: "openwrt.org"

Root cause: PHP syntax has changed from 7.1+ onwards and now complains about declarations like $dkey = '';

Solution: change $dkey = ''; to $dkey = array(); -> error is gone

For more information on the background, just search the net for Uncaught Error: [] operator not supported for strings, and youo will get plenty results.

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

1 participant