maxpozdeev / mytinytodo

Todo list script
156 stars 49 forks source link

Markdown parse results in server error 500 #87

Closed n00rm closed 7 months ago

n00rm commented 7 months ago

Hi, I came across a strange bug that resulted in an application crash. Markdown support is enabled in the settings. image

Versions where I could reproduce this bug: 1.8.0 & 1.8.1

Putting the following text in the Task notes crashes the application because it can't be parsed to Markdown:

Application Proto Client Server Duration Score Breakdown Actual Thpt Total Bytes Info Flow Exporter IP Input Interface Output Interface DNS Guess UDP  client.example.com L:46753 1.1.1.1  R:domain 00:36 sec 100 Client 600.00 bps  326 Bytes  Firewall LAG01.90 Port5_ppp Server
DNS Guess UDP  client.example.com L:37845 1.1.1.1  R:domain 00:39 sec 100 Client 600.00 bps  278 Bytes  Firewall LAG01.90 Port5_ppp Server
DNS Guess UDP  client.example.com L:57273 1.1.1.1  R:domain 00:35 sec 100 Client 544.00 bps  240 Bytes  Firewall LAG01.90 Port5_ppp Server

Error Log:

[Mon Feb 05 09:36:02.510791 2024] [php7:error] [pid 1083] [client 10.20.6.101:63605] PHP Fatal error: Uncaught Error: Call to undefined function mb_strlen() in /var/www/html/todo/includes/vendor/erusev/parsedown/Parsedown.php:170\nStack trace:\n#0 /var/www/html/todo/includes/vendor/erusev/parsedown/Parsedown.php(39): Parsedown->lines()\n#1 /var/www/html/todo/includes/markup.parsedown.php(27): Parsedown->text()\n#2 /var/www/html/todo/includes/markup.php(49): MTTParsedownWrapper->convert()\n#3 /var/www/html/todo/includes/markup.php(44): markdownToHtml()\n#4 /var/www/html/todo/includes/api/TasksController.php(636): noteMarkup()\n#5 /var/www/html/todo/includes/api/TasksController.php(128): TasksController->prepareTaskRow()\n#6 /var/www/html/todo/api.php(123): TasksController->get()\n#7 {main}\n thrown in /var/www/html/todo/includes/vendor/erusev/parsedown/Parsedown.php on line 170, referer: https://todo.example.com/todo/

maxpozdeev commented 7 months ago

Hi, this is due to missing function mb_strlen(). You need to install mbstring php extension.

n00rm commented 7 months ago

Hi @maxpozdeev,

installing the mbstring php extension resolved the issue. Thanks!