Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

E_notice errors. Let's post them here and help eachother out.


kurios

Recommended Posts

Let's collect e-notice errors here and make it a reference thread. My knowledge is (very) limited but if i can help I will.

 

My problems that i havent been able to solve from the forums are:

 

Error: Constant already defined
File: includes/application_top.php
Line: 97

 

comes up four times, Line 97 in said file reads:

define($configuration['cfgKey'], $configuration['cfgValue']);

 

Next:

Error: Undefined index: manufacturers_id
File: includes/header_tags.php
Line: 36

 

Line 36 reads:

$manStr = "select mi.manufacturers_htc_title_tag as htc_title_tag, mi.manufacturers_htc_desc_tag as htc_desc_tag, mi.manufacturers_htc_keywords_tag as htc_keywords_tag from " . TABLE_MANUFACTURERS . " m LEFT JOIN " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'";

 

 

Next:

Error: Undefined index: specials_new_products_price
File: includes/boxes/scrolling_best_sellers.php
Line: 26

 

Line 26 reads:

if (intval($random_product['specials_new_products_price']) > 0) {

 

Next:

Error: Undefined offset: 5
File: includes/boxes/scrolling_best_sellers.php
Line: 44

 

Line 44 reads:

echo "pausecontent_bs[".$i."] = '".$pausecontent_bs[$i]."';

Link to comment
Share on other sites

Error: Constant already defined
File: includes/application_top.php
Line: 97

 

These configuration settings come from the database configuration table, the error suggests that you have an entry duplicated for field configuration_key.

 

Error: Undefined index: manufacturers_id
File: includes/header_tags.php
Line: 36

 

Variable must be set before they are used like ..

 

$manufacturers_id = '';

 

Code where variables are not set is a hackers paradise.

 

 

Next:

Error: Undefined index: specials_new_products_price
File: includes/boxes/scrolling_best_sellers.php
Line: 26

 

Same as above.

 

Next:

Error: Undefined offset: 5
File: includes/boxes/scrolling_best_sellers.php
Line: 44

 

Line 44 reads:

echo "pausecontent_bs[".$i."] = '".$pausecontent_bs[$i]."';

 

The script is trying to read an array key that does not exist.

 

e.g.

 

$array = array( '0', '1', '2', '3' );

echo $array[4];

 

This key doesn't exist and therefore the error.

Link to comment
Share on other sites

May I add to this? I've got a few as well.

 

Error Type: [E_NOTICE] Undefined variable: result
On line 51
File includes/sef.php

Line 51: $result .= $cat_name['categories_id'];

 

I read above where FWR said the variable must be defined. To define it, do I simply have to add $result =''; (above/below the call) and it's defined? I'm not really sure what to do.

 

 

Error Type: [E_STRICT] strtotime() [<a href='function.strtotime'>function.strtotime</a>]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead
On line 54
File includes/classes/supertracker.php

Line 54: $existing_session = false;

 

 

Error Type: [E_WARNING] fopen(/home/mysite/cachefile/categories_box-english.cache612_4100) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
On line 58
File includes/functions/cache.php

Line 58: if ($fp = @fopen($filename, 'r')) {

I assume this error means the file was deleted seconds before somebody clicked on this page, which resulted in the cache file being missing. What can I do to circumvent this, aside from suppressing the error.. which I've already done (and which is in bad practice, I know).

 

 

Error Type: [E_NOTICE] Undefined offset:  1
On line 176
File includes/classes/supertracker.php

Line 176: $referrer=$refer_data[0];

Link to comment
Share on other sites

Looking forward to it. :)

 

 

My $result error really has me scratching my head. I attribute the error to the fact it isn't called under isset(), but I'm not sure how to set that. The full call:

		if( $cat_name = tep_db_fetch_array($cat_Q) ) {
         if(!$count) {
	    $result .= $cat_name['categories_id'];
	    $count = true;
	  } else {
	    $result .= '_' . $cat_name['categories_id'];
	  }

         $parent = $cat_name['categories_id'];

       } else {

         require('includes/unknown.php');

         exit();
}

 

So, around !$count - do I simply wrap that in isset()? If so, does the ! get removed?

 

Any suggestions?

Link to comment
Share on other sites

Looking forward to it. :)

 

 

My $result error really has me scratching my head. I attribute the error to the fact it isn't called under isset(), but I'm not sure how to set that. The full call:

		if( $cat_name = tep_db_fetch_array($cat_Q) ) {
         if(!$count) {
	    $result .= $cat_name['categories_id'];
	    $count = true;
	  } else {
	    $result .= '_' . $cat_name['categories_id'];
	  }

         $parent = $cat_name['categories_id'];

       } else {

         require('includes/unknown.php');

         exit();
}

 

So, around !$count - do I simply wrap that in isset()? If so, does the ! get removed?

 

Any suggestions?

 

String concatenation operator .= will join a string on the right of the operator to an already existent string on the left. Your issue is that the string on the left ( $result ) has not been set, the following is correct: -

 

 

if( $cat_name = tep_db_fetch_array( $cat_Q ) ) {
 $result = ''; // Set the $result variable
 if( !$count ) {
   $result .= $cat_name['categories_id'];
   $count = true;
 } else {
   $result .= '_' . $cat_name['categories_id'];
 }
 $parent = $cat_name['categories_id'];
} else {
 require('includes/unknown.php');
 exit();
}

Link to comment
Share on other sites

When I add:

$result = ''; // Set the $result variable

 

just beneath:

if( $cat_name = tep_db_fetch_array( $cat_Q ) ) {

 

my category tree & breadcrumbs disappear.

Did I do something incorrectly?

Link to comment
Share on other sites

When I add:

$result = ''; // Set the $result variable

 

just beneath:

if( $cat_name = tep_db_fetch_array( $cat_Q ) ) {

 

my category tree & breadcrumbs disappear.

Did I do something incorrectly?

 

Mine was an example based on the code shown and the error .. what is going on above or below the code snippet I haven't a clue as it is non standard code.

Link to comment
Share on other sites

I have the following bugs index.php page:

 

E_STRICT Errors:

 

Error: Non-static method KissMT_Modules::stripStopWords() cannot be called statically, assuming $this from compatible context KissMT_Module
File: includes/modules/kiss_meta_tags/abstracts/kiss_modules.php
Line: 134

 

Code in Line 134:

 

array_walk( $words_as_array, array( __CLASS__, 'stripStopWords' ) );

 

 

E_NOTICE Errors:

 

Error: Constant HEADING_TITLE already defined
File: includes/languages/english/news.php
Line: 12

 

Code in line 12:

define('HEADING_TITLE', 'News');

 

Observation: I have Info pages - welcome pages, and perhaps this be conflicting.

 

Error: Undefined index: action
File: includes/boxes/news.php
Line: 18

 

 

Error: Undefined variable: content
File: includes/boxes/news.php
Line: 31

 

Error: Undefined index: date
File: includes/boxes/news.php
Line: 44

 

Following is the code of news.php:

 

<?php
/*
 $Id: news.php, v 1.0 2009/01/27 17:00:00 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
 Addition to contribution by Lunaxod
 [email protected] url:www.charger.od.ua
*/
?>
         <tr>
           <td>
<?php
 if ($_GET['action'] == 'reply') {
  $id = (int)tep_db_prepare_input($_POST['id']);
  $name = tep_db_prepare_input($_POST['name']);
  $content = tep_db_prepare_input2($_POST['content']);
  $username = tep_db_prepare_input($_POST['username']);
  $email = tep_db_prepare_input($_POST['email']);
  $date = date("Y-m-d G:i:s");
  if (NEWS_APPROVED == 'true') { 
       $approved = 0;
     } else {
     $approved = 1;
    }
}
  $content = strip_tags($content, '<p>');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_NEWS);

 new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_NEWS));

   $listing_sql = "select n.id, n.date_created, nd.name, nd.content, n.replys from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where nd.language_id = '" . (int)$languages_id . "' and n.id = nd.news_id";


 $info_box_contents = array();
if ($_GET['date'] == true) {
   $month_date = tep_db_prepare_input($_GET['date']);
   $listing_sql .= " and month_date = '$month_date'";
}
   $listing_sql .= " order by id desc";
   $listing_split = new splitPageResults($listing_sql, 5);
    if ($listing_split->number_of_rows > 0) {
   $listing_query = tep_db_query($listing_split->sql_query);
   while ($listing = tep_db_fetch_array($listing_query)) {
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_NEWS, 'article=' . $listing['id']) . '">' . $listing['name'] . ' <i>' . tep_date_short($listing['date_created']) . '</i></a><br>');
}
}


 new infoBox($info_box_contents);
?>
           </td>
         </tr>

 

Can this occour due to replacing HTTP_GET_VARS and HTTP_POST_VARS directly in the code (i have the sam's clean POST and GET VARS contribution).

Link to comment
Share on other sites

@Francys

 

The E_STRICT error for KissMT was handled ages ago in the support forum but a new version has not been uploaded as yet.

 

catalog/includes/modules/kiss_meta_tags/abstracts/kiss_modules.php

 

Line 280

 

change to ..

   private static function stripStopWords( &$word ) {

Link to comment
Share on other sites

  • 1 month later...

Only got but 2 files -

Any help will be gladly accepted

 

Please post solution

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 116

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 178

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 141

 

Code piece starting line 116 /includes/boxes/ul_categories.php

    $output .= '<ul id="'.$idname_for_menu.'">';
   $output .= tep_make_cat_ulbranch($rootcatid, $table, 0, $maxlevel);

   // Close off nested lists
   for ($nest = 0; $nest <= $GLOBALS['this_level']; $nest++) {
       //if ($nest == '1') { $output .= '</li>'; } // my change

       $output .= '</ul>';        
       }

   return $output;
}

// Create the branches of the unordered list
function tep_make_cat_ulbranch($parcat, $table, $level, $maxlevel) {

   global $cPath_array, $classname_for_selected, $classname_for_parent;

   $list = $table[$parcat];

   while(list($key,$val) = each($list)){

       if ($GLOBALS['this_level'] != $level) {

               if ($GLOBALS['this_level'] < $level) {
                       $output .= "\n".'<ul>';
                   } else {
               for ($nest = 1; $nest <= ($GLOBALS['this_level'] - $level); $nest++) {
                   $output .= '</ul></li>'."\n";    
                   }
   /*                            
                               if ($GLOBALS['this_level'] -1 == $level)
$output .= '</ul></li>'."\n";
elseif ($GLOBALS['this_level'] -2 == $level)
$output .= '</ul></li></ul></li>'."\n";
elseif ($GLOBALS['this_level'] -3 == $level)
$output .= '</ul></li></ul></li></ul></li>'."\n";
elseif ($GLOBALS['this_level'] -4 == $level)
$output .= '</ul></li></ul></li></ul></li></ul></li>'."\n"; 
   */                            
                       }            

               $GLOBALS['this_level'] = $level;
       }

       if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) {
           $this_cat_class = $classname_for_selected . ' ';
       } else {
           $this_cat_class = '';        
           }    


       if (!$level) {
                   unset($GLOBALS['cPath_set']);
                       $GLOBALS['cPath_set'][0] = $key;
           $cPath_new = 'cPath=' . $key;

       } else {
                       $GLOBALS['cPath_set'][$level] = $key;        
           $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));
       }

       $output .= '<li class="';

       if (tep_has_category_subcategories($key) && $classname_for_parent) {
           $this_parent_class = ' '.$classname_for_parent.'"';
           $output .= $classname_for_parent.' ';
       } else {
           $this_parent_class = '';
           }    

 

and a couple of - Notice: Undefined index: specials_new_products_price in C:\xampp\htdocs\www\shop\includes\boxes\scrolling_new_products.php on line 23

 

Code starting line 23 - scrolling_new_products.php

if (intval($random_product['specials_new_products_price']) > 0) {
       $pausecontent_np[$i] .= "<s>" . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . "</s><br/><span class=\'productSpecialPrice\'>" . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']))."</span></center><br/><br/>";
   } else {

 

Thank you for your valuable time going through this

Getting the Phoenix off the ground

Link to comment
Share on other sites

  • 1 month later...

I too have an error that I am unable to straighten out. It works well but I get this error when not suppressing output errors.

 

Error: Undefined variable: cPath_array

 

I have gone through this contribution (that throws this error) and this is the only part that is in this file. I marked the error line and included it below. Any help is appreciated.

 

// Contribution - Cateogory Description v1.04 by mightyx

error line --> $categories_desc_query = tep_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[count($cPath_array)-1] . "' and language_id = '" . (int)$languages_id . "'");

 

$categories_desc = tep_db_fetch_array($categories_desc_query);

 

// end of Cateogory Description

Link to comment
Share on other sites

I too have an error that I am unable to straighten out. It works well but I get this error when not suppressing output errors.

 

Error: Undefined variable: cPath_array

 

I have gone through this contribution (that throws this error) and this is the only part that is in this file. I marked the error line and included it below. Any help is appreciated.

 

// Contribution - Cateogory Description v1.04 by mightyx

error line --> $categories_desc_query = tep_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[count($cPath_array)-1] . "' and language_id = '" . (int)$languages_id . "'");

 

$categories_desc = tep_db_fetch_array($categories_desc_query);

 

// end of Cateogory Description

 

 

Just a quick update... Here is how just in case someone else has the same issue.

I suppressed the output error by moving this entire query out of application_top and into the index page (the only place it is needed) just above the call for the output.

Link to comment
Share on other sites

  • 4 months later...

Only got but 2 files -

Any help will be gladly accepted

 

Please post solution

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 116

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 178

 

Notice: Undefined variable: output in C:\xampp\htdocs\www\shop\includes\boxes\ul_categories.php on line 141

 

Code piece starting line 116 /includes/boxes/ul_categories.php

    $output .= '<ul id="'.$idname_for_menu.'">';
   $output .= tep_make_cat_ulbranch($rootcatid, $table, 0, $maxlevel);

   // Close off nested lists
   for ($nest = 0; $nest <= $GLOBALS['this_level']; $nest++) {
       //if ($nest == '1') { $output .= '</li>'; } // my change

       $output .= '</ul>';        
       }

   return $output;
}

// Create the branches of the unordered list
function tep_make_cat_ulbranch($parcat, $table, $level, $maxlevel) {

   global $cPath_array, $classname_for_selected, $classname_for_parent;

   $list = $table[$parcat];

   while(list($key,$val) = each($list)){

       if ($GLOBALS['this_level'] != $level) {

               if ($GLOBALS['this_level'] < $level) {
                       $output .= "\n".'<ul>';
                   } else {
               for ($nest = 1; $nest <= ($GLOBALS['this_level'] - $level); $nest++) {
                   $output .= '</ul></li>'."\n";    
                   }
   /*                            
                               if ($GLOBALS['this_level'] -1 == $level)
$output .= '</ul></li>'."\n";
elseif ($GLOBALS['this_level'] -2 == $level)
$output .= '</ul></li></ul></li>'."\n";
elseif ($GLOBALS['this_level'] -3 == $level)
$output .= '</ul></li></ul></li></ul></li>'."\n";
elseif ($GLOBALS['this_level'] -4 == $level)
$output .= '</ul></li></ul></li></ul></li></ul></li>'."\n"; 
   */                            
                       }            

               $GLOBALS['this_level'] = $level;
       }

       if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) {
           $this_cat_class = $classname_for_selected . ' ';
       } else {
           $this_cat_class = '';        
           }    


       if (!$level) {
                   unset($GLOBALS['cPath_set']);
                       $GLOBALS['cPath_set'][0] = $key;
           $cPath_new = 'cPath=' . $key;

       } else {
                       $GLOBALS['cPath_set'][$level] = $key;        
           $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));
       }

       $output .= '<li class="';

       if (tep_has_category_subcategories($key) && $classname_for_parent) {
           $this_parent_class = ' '.$classname_for_parent.'"';
           $output .= $classname_for_parent.' ';
       } else {
           $this_parent_class = '';
           }    

 

and a couple of - Notice: Undefined index: specials_new_products_price in C:\xampp\htdocs\www\shop\includes\boxes\scrolling_new_products.php on line 23

 

Code starting line 23 - scrolling_new_products.php

if (intval($random_product['specials_new_products_price']) > 0) {
       $pausecontent_np[$i] .= "<s>" . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . "</s><br/><span class=\'productSpecialPrice\'>" . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id']))."</span></center><br/><br/>";
   } else {

 

Thank you for your valuable time going through this

 

Hello Pierre,

Wondering if you ever got this issue worked out because I have the same problem.

Link to comment
Share on other sites

  • 3 weeks later...

Hello Pierre,

Wondering if you ever got this issue worked out because I have the same problem.

 

Hi,

 

I got it worked by just adding a line:

$output = "";

under the line with declaretion of globals in each of the functions where $output is been used.

 

Hope tis correct.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...