Skip to content

Fatal error when updating a link with an ampersand in its name #5021

@KrSi78

Description

@KrSi78

When one updates a link with an ampersand in its name, updating fails with an 500 error:

Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in ./main/inc/lib/kses-0.2.2/kses.php:718
Stack trace:
#0 ./main/inc/lib/kses-0.2.2/kses.php(718): in_array()
#1 [internal function]: kses_named_entities()
#2 ./main/inc/lib/kses-0.2.2/kses.php(693): preg_replace_callback()
#3 ./main/inc/lib/kses-0.2.2/kses.php(105): kses_normalize_entities()
#4 ./main/inc/lib/formvalidator/FormValidator.class.php(2044): kses()
#5 ./main/inc/lib/pear/HTML/QuickForm.php(1256): html_filter()
#6 ./main/inc/lib/pear/HTML/QuickForm.php(1225): HTML_QuickForm->_recursiveFilter()
#7 ./main/inc/lib/formvalidator/FormValidator.class.php(219): HTML_QuickForm->applyFilter()
#8 ./main/inc/lib/link.lib.php(1620): FormValidator->addText()
#9 ./main/link/link.php(141): Link::getLinkForm()
#10 {main} thrown in ./main/inc/lib/kses-0.2.2/kses.php on line 718

This bug is introduced after AngelFQC has added an HTML filter (see 4a58770#diff-acef17cb3f0847820d1a81a239c1efe142b0b8d8c9ca1dd727d4228d925e62ca).

I'm on Chamilo 1.11.26 running PHP 8.0 on Ubuntu Jammy Jellyfish.

I expect upgrading kses from the version hosted on SourceForge (https://sourceforge.net/projects/kses/) to the (?) one hosted on GitHub (https://github.com/soosyze/kses), will fix this. I didn't' test this as it requires some rework in the FormValidator class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions