Notice: Undefined index: extensions in file /class/module.textsanitizer.php line 622
Warning: array_filter() expects parameter 1 to be array, null given in file /class/module.textsanitizer.php line 622
This was a tricky bug, at least for me!
First, I was looking at the chain of events, trying to figure out what was calling the function executeExtensions, inside which the array_filter was located?
It was:
displayTarea
--> xoopsCodeDecode($text);
------> executeExtensions
I was looking at the parameters of the various displayTarea calls from within WF-Links, like this one:
$link['description2'] = $wfmyts -> displayTarea( $link_arr['description'], 1, 1, 1, 1, 1 );
but couldn't find anything wrong.
But in the debugger, I saw that the value for $this->config['extensions'] was null:
$this->config['extensions'] = null
I compared a similar call to displayTarea in xForms,
$xoopsTpl->assign('forms_intro', $myts->displayTarea($xoopsModuleConfig['intro']));
and it was:
$this->config['extensions'] = {array}[11]
iframe = 0
image= 1
flash = 1
youtube = 1
mp3 = 0
wmp = 0
wiki = false
mms = 0
rtsp = 0
ul = 0
li = 0
So something was wrong with our $wfmyts.
WF-Links, the same as XoopsTube, is extending MyTextSanitizer in /class/myts_extended.php
class wflTextSanitizer extends MyTextSanitizer
{
function wflTextSanitizer() {
}
function htmlSpecialCharsStrip( $text )
{
return $this -> htmlSpecialChars( $this -> stripSlashesGPC( $text) );
}
}
Now the question, what is wrong with it, and what consequences does it have?
I realized that the function
function wflTextSanitizer() {
}
was overriding the original construction method of MyTextSanitizer:
function __construct()
{
$this->path_basic = XOOPS_ROOT_PATH . '/class/textsanitizer';
$this->path_plugin = XOOPS_ROOT_PATH . '/Frameworks/textsanitizer';
$this->config = $this->loadConfig();
}
and as a result the "$this->loadConfig()", which was loading the extensions, was never executed.
After removing it, all the errors related to "Undefined index: extensions" are gone.