Beste Lezer,

Ik heb op onze webshop een module geplaatst zodat klanten in een scherm hun order kunnen afhandelen. Nu krijg ik de onderstaande foutmelding.

Warning: Illegal string offset 'id' in /public_html/includes/classes/shipping.php on line 25

Warning: Illegal string offset 'id' in /public_html/includes/classes/shipping.php on line 25

Dit is de php code:

<?php
if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+2)), $this->modules)) ) {

?>


Dit is de volledige code

<?php
if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+2)), $this->modules)) ) {
          $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
        } else {
          reset($this->modules);
          while (list(, $value) = each($this->modules)) {
            $class = substr($value, 0, strrpos($value, '.'));
            $include_modules[] = array('class' => $class, 'file' => $value);
          }
        }
?>


Wij gebruiken het eCommerce systeem osCommerce nieuwste versie 2.3.

Ik hoor graag een reactie.

Alvast bedankt voor de reactie
Dustin
Waarschijnlijk zit het veld id niet in de array, lees je array eens uit en kijk wat erin zit.

var_dump($module); 
Sterker nog, $module is blijkbaar een string en helemaal geen array.
En ik zie dat er ook $PHP_SELF wordt gebruikt. Die variabele wordt al zo'n 8 jaar (of langer zelfs) niet meer gevuld door PHP zelf.

Ik hoop van harte dat je script niet behoorlijk verouderd is.
Sorry nogmaals even goed naar de code gekeken en dit is de volledige code
___________________________



// class constructor
    function shipping($module = '') {
      global $language, $PHP_SELF;

      if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
        $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

        $include_modules = array();

        if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+2)), $this->modules)) ) {
          $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
        } else {
          reset($this->modules);
          while (list(, $value) = each($this->modules)) {
            $class = substr($value, 0, strrpos($value, '.'));
            $include_modules[] = array('class' => $class, 'file' => $value);
          }
        }

        for ($i=0, $n=sizeof($include_modules); $i<$n; $i++) {
          include_once(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file']);
          include_once(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']);

          $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
        }
      }
    }

_______________________________________________________________________

Hoop dat het zo wat duidelijker is

Reageren