Answer the question
In order to leave comments, you need to log in
What could be the problem in DLE 10.6 + PHP7 with the check_module function in which preg_replace_callback is called in the regex passed not-aviable?
Good day.
The following code [not-aviable=faq]smth[/not-aviable] is called in the main.tpl template file and it works correctly on php 5.6. Further, the site is transferred to php 7 and the template becomes simply empty. After a long search, I came to the conclusion that if you remove all references to [not-aviable], the site starts working correctly.
We climb deeper, namely, we find the check_module method in templates.class.php and see the following code there:
function check_module($matches) {
global $dle_module;
$regex = '/\[(aviable|available|not-aviable|not-available)=(.+?)\]((?>(?R)|.)*?)\[\/\1\]/is';
if (is_array($matches)) {
$aviable = $matches[2];
$block = $matches[3];
if ($matches[1] == "aviable" OR $matches[1] == "available") $action = true; else $action = false;
$aviable = explode( '|', $aviable );
if( $action ) {
if( ! (in_array( $dle_module, $aviable )) and ($aviable[0] != "global") ) $matches = '';
else $matches = $block;
} else {
if( (in_array( $dle_module, $aviable )) ) $matches = '';
else $matches = $block;
}
}
return preg_replace_callback($regex, array( &$this, 'check_module'), $matches);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question