Lots of warnings in php_errorlog

johnbroeckaert

I tried the option of @Jacobi22 first. I works fine!
Thank YOU UWE.

global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;

dbs

You could also try to delete the droplet and then do a manually upgrade of the module droplets.
All missing WB droplets will installed (from the example folder).

An WB 2.10 upgrade will not replace old droplets with newer ones.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Gast

add $section_id to the line with the global, seperated by comma
like
global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;


Here the new Code from the repaired Droplet Section Picker, included in WB 2.11

global $database$wb$TEXT$DGTEXT,$section_id,$page_id;
    
$sRetVal '';
    
$content '';
    
$_sFrontendCss '';
    
$sid = isset( $sid) ? intval$sid) : 0;
    if ( 
intval$sid) > 0) {
        
$now time();
        
$sql 'SELECT `s`.*'
              
.     ', `p`.`viewing_groups`'
              
.     ', `p`.`visibility`'
              
.     ', `p`.`menu_title`'
              
.     ', `p`.`link` '
              
'FROM `'.TABLE_PREFIX.'sections` `s`'
              
'INNER JOIN `'.TABLE_PREFIX.'pages` `p` '
              
.    'ON `p`.`page_id`=`s`.`page_id` '
              
'WHERE `s`.`section_id` = '.( int)$sid.' '
              
.   'AND ('
              
.         '('.$now.'>=`s`.`publ_start` OR `s`.`publ_start`=0) AND '
              
.         '('.$now.'<=`s`.`publ_end` OR `s`.`publ_end`=0) '
              
.       ')'
              
.   'AND `p`.`visibility` NOT IN (\'deleted\') '
              
.   '  ';
        if ( 
$oSection $database->query$sql)) {
            while ( 
$aSection $oSection->fetchRowMYSQLI_ASSOC)) {
                
$section_id $aSection['section_id'];
                
$module $aSection['module'];
                
ob_start();
                require ( 
WB_PATH.'/modules/'.$module.'/view.php');
                
$content ob_get_clean();
                
$_sFrontendCss '/modules/'.$module.'/frontend.css';
                
$_sFrontendCssrUrl WB_URL.$_sFrontendCss;
                
$_sSearch preg_quoteWB_URL.'/modules/'.$module.'/frontend.css''/');
                if ( 
preg_match'/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si'$content)) {
                    
$_sFrontendCss '';
                } else {
                    
$sFrontend '/modules/'.$module.'/frontend';
                    
$sFrontendJsFile  = (is_readable(WB_PATH.$sFrontend.'.js')?WB_URL.$sFrontend.'.js':'"";');
                    
$sFrontendCssFile = (is_readable(WB_PATH.$sFrontend.'.css')?WB_URL.$sFrontend.'.css':'"";');
                    
$_sFrontendCss '
                      <script>
                      <!--
                          try {
                              var ModuleCss = '
.$sFrontendCssFile.'
                              var ModuleJs  = '
.$sFrontendJsFile.'
                              if (ModuleCss!==""){
                                  if (typeof LoadOnFly === "undefined"){
                                      include_file(ModuleCss, "css");
                                  } else {
                                      LoadOnFly("head", ModuleCss);
                                  }
                              }
                              if (ModuleJs!==""){
                                  include_file(ModuleJs, "js");
                              }
                          } catch(e) {
                           /* alert("An error has occurred: "+e.message)*/
                          }
                      -->
                      </script>
                      '
;
                }
            }
        }
    }
    return 
$_sFrontendCss.$content;


johnbroeckaert

Hallo Dietmar,

These errors come with the droplets in the 2.10 package version 3.0.22 . Mostly SectionPicker.
This is the code of this droplet:

global $database, $wb, $TEXT, $DGTEXT;
$content = '';
$sid = isset($sid) ? intval($sid) : 0;
if( $sid ) {
$sql  = 'SELECT `module` FROM `'.TABLE_PREFIX.'sections` ';
$sql .= 'WHERE `section_id`='.$sid;
if (($module = $database->get_one($sql))) {
if (is_readable(WB_PATH.'/modules/'.$module.'/view.php')) {
$_sFrontendCss = '/modules/'.$module.'/frontend.css';
if(is_readable(WB_PATH.$_sFrontendCss)) {
$_sSearch = preg_quote(WB_URL.'/modules/'.$module.'/frontend.css', '/');
if(preg_match('/<link[^>]*?href\s*=\s*\"'.$_sSearch.'\".*?\/>/si', $wb_page_data)) {
$_sFrontendCss = '';
}else {
$_sFrontendCss = '<link href="'.WB_URL.$_sFrontendCss.'" rel="stylesheet" type="text/css" media="screen" />';
}
} else { $_sFrontendCss = ''; }
ob_start();
[b]$oldSid = $section_id; // save old sectionID[/b]
$section_id = $sid;
require(WB_PATH.'/modules/'.$module.'/view.php');
$content = $_sFrontendCss.ob_get_clean();
$section_id = $oldSid; // restore old sectionID
}
}
}
return $content;



The thick line is nr 19.
Thanks

Luisehahne

Hallo,

that means, in one of your droplet you have an error in line 19. There is call of a none existing variable
"Undefined variable: section_id". Pls check your droplet code.

Dietmar
Note: Once the code has been generated, it is easy to debug. It's not a bug, it's a feature!

johnbroeckaert

Hi,

I updatrs my site to 2.10 and I use a lot of droplets to show content on different pages.
My errorlog is full of theze warnings:
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"
2018-01-10T15:37:16+00:00 [E_NOTICE] /modules/droplets/droplets.php(37) : eval()'d code:[19] from /modules/droplets/droplets.php:[86] do_eval "Undefined variable: section_id"


Everything is working but do I have to do something?
Thanks