dokuwiki icon indicating copy to clipboard operation
dokuwiki copied to clipboard

TypeError: call_user_func_array()

Open LMS235 opened this issue 3 years ago • 13 comments

On a new Install with NGINX 1.18 and PHP 8.1.2 the search indexer stucked (always on the same page).

here is the error from the command line (php bin/indexer.php):

☠ TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, second array member is not a valid method in .../inc/parserutils.php:525
Stack trace:
#0 .../inc/parserutils.php(289): p_render_metadata()
#1 .../inc/indexer.php(147): p_get_metadata()
#2 .../bin/indexer.php(82): idx_addPage()
#3 .../bin/indexer.php(71): IndexerCLI->index()
#4 .../bin/indexer.php(57): IndexerCLI->update()
#5 .../vendor/splitbrain/php-cli/src/CLI.php(175): IndexerCLI->main()
#6 .../vendor/splitbrain/php-cli/src/CLI.php(97): splitbrain\phpcli\CLI->execute()
#7 .../bin/indexer.php(107): splitbrain\phpcli\CLI->run()
#8 {main}

LMS235 avatar Sep 30 '22 13:09 LMS235

View the page also crash:

image

ERROR:

2022-09-30 14:21:06    .../inc/parserutils.php(525)      TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, second array member is not a valid method
#0 .../inc/parserutils.php(289): p_render_metadata()
#1 .../inc/common.php(246): p_get_metadata()
#2 .../doku.php(97): pageinfo()
#3 {main}

Release 2022-07-31a "Igor"

LMS235 avatar Sep 30 '22 14:09 LMS235

any news to this topic?

LMS235 avatar Feb 17 '23 08:02 LMS235

https://github.com/splitbrain/dokuwiki/blob/a24500554c259f9aa4cc688547a435181317028e/inc/parserutils.php#L522-L526

One of the instructions seems to be incomplete. I guess it is interesting to see which one. Do you have the possibility to create a bit more debug output?

Klap-in avatar Feb 17 '23 08:02 Klap-in

I'm afraid I don't know how. I just get this error when I call the page (admittedly a very complex page).

LMS235 avatar Feb 17 '23 09:02 LMS235

Which plugins are used on that page? Is it possible to relate it to one of the plugins for example by temporary disabling/enabling them, or temporarily only having a part of the syntax on that page?

Klap-in avatar Feb 17 '23 12:02 Klap-in

nothing special, but heavy use of wrap plugin

Unfortunately, it is not displayed where the problem would be exactly, then you could narrow it down.

LMS235 avatar Feb 17 '23 13:02 LMS235

I could at least narrow it down now, since we work a lot with the WRAP plugin and tables, it often happens that the line in the source code looks like this:

...
text</WRAP> |
| text
...

and then the whole thing crashes. If I make this from the upper line, nothing happens:

...
text</WRAP>
| text
...

Probably the line break is not set cleanly somewhere here, since we also create and edit tables with EditTable. Maybe this will help a little.

LMS235 avatar Feb 17 '23 13:02 LMS235

And one more thing, the source code works WITHOUT problems on this web server:

webserver Apache php_version 7.4.33 php_sapi fpm-fcgi

And also on this webserver

webserver Apache/2.4.54 (Unix) php_version 8.0.27 php_sapi cgi-fcgi

But NOT on this one (online if i change the line like above)

webserver nginx/1.18.0 php_version 8.1.2-1ubuntu2.10 php_sapi fpm-fcgi

LMS235 avatar Feb 17 '23 13:02 LMS235

Probably the line break is not set cleanly somewhere here, since we also create and edit tables with EditTable.

Are you sure this is a line break? EditTable sometimes inserts a lot of spaces when the cell contents are very different in width. This spreads a line of code over several lines of the editor. Turn off automatic wrapping in the editor window and you will see the actual lines.

- Michael Sy.

Michaelsy avatar Feb 17 '23 14:02 Michaelsy

Probably the line break is not set cleanly somewhere here, since we also create and edit tables with EditTable.

Are you sure this is a line break? EditTable sometimes inserts a lot of spaces when the cell contents are very different in width. This spreads a line of code over several lines of the editor. Turn off automatic wrapping in the editor window and you will see the actual lines.

  • Michael Sy.

The problem is, in 2 Dokuwiki installations with Apache and PHP 7.4.33 and PHP 8.0.27 it works, on NGINX with PHP 8.1.2 it does not work. the same file (ascii copy)

and it's not a linebreak, it's the " |" in the first line that causes problems (3x blank and 1x |)

LMS235 avatar Feb 17 '23 14:02 LMS235

UPDATE:

Main Error is

AH01071: Got error 'PHP message: PHP Warning: Undefined array key 0 in /......./inc/parserutils.php on line 540'

So I inserted the following code in line 540

if (empty($instruction[0])) return false;

then the page works as desired. Unfortunately, I can not estimate the "side effects" since I am not a developer. Can anyone check this?

LMS235 avatar Apr 11 '23 07:04 LMS235

The problem can now be recreated with sample code:

PROBLEM CODE:

| TEXT  | <WRAP>TEXT<WRAP 50%>
^ A       ^ B         ^ 
| 1  | 2 |
| 1  | 2 |
</WRAP>
TEXT</WRAP>  |

OK CODE:

| TEXT  | <WRAP>TEXT<WRAP 50%>
^ A       ^ B         ^ 
| 1  | 2 |
| 1  | 2 |
</WRAP>
TEXT</WRAP>|

The problem comes from the last </WRAP> |, if there are spaces between > and |, the problem occurs. So </WRAP>| => OK, </WRAP> | => Crash.

This can only be a BUG. I just don't know if in the Dokuwiki or in WRAP.

LMS235 avatar Apr 14 '23 08:04 LMS235