Author Topic: Lots of warnings in php_errorlog  (Read 2453 times)

Offline johnbroeckaert

  • Posts: 218
  • Gender: Male
Lots of warnings in php_errorlog
« on: January 10, 2018, 05:28:41 PM »
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:
Code: [Select]
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
It is a happy talent to know how to play!

Offline Luisehahne

  • WebsiteBaker Org e.V.
  • **
  • Posts: 4384
  • Gender: Male
    • Webdesign und Entwicklung WebsiteBaker
Re: Lots of warnings in php_errorlog
« Reply #1 on: January 10, 2018, 05:43:15 PM »
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
Immer nur von der Zukunft reden, die Gegenwart vergessen und auf die Vergangenheit schimpfen
Neues Unwort: Schnappatmung

Offline johnbroeckaert

  • Posts: 218
  • Gender: Male
Re: Lots of warnings in php_errorlog
« Reply #2 on: January 10, 2018, 07:37:17 PM »
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:

Code: [Select]
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
It is a happy talent to know how to play!

Offline Gast

  • Posts: 5920
Re: Lots of warnings in php_errorlog
« Reply #3 on: January 10, 2018, 07:56:40 PM »
add $section_id to the line with the global, seperated by comma
like
Code: [Select]
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;


Offline dbs

  • Betatester
  • **
  • Posts: 8228
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Lots of warnings in php_errorlog
« Reply #4 on: January 10, 2018, 11:09:26 PM »
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.

Offline johnbroeckaert

  • Posts: 218
  • Gender: Male
Re: Lots of warnings in php_errorlog
« Reply #5 on: January 11, 2018, 08:04:38 AM »
I tried the option of @Jacobi22 first. I works fine!
Thank YOU UWE.

Code: [Select]
global $database, $wb, $TEXT, $DGTEXT,$section_id,$page_id;
It is a happy talent to know how to play!

 

postern-length