SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2001
    Location
    united states
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help please Invalid argument

    Hello,
    I installed phpwebsite and i get this error message:

    Warning: Invalid argument supplied for foreach() in /home/web/portal/portalsite/core/Core.php on line 311
    Warning: Invalid argument supplied for foreach() in /home/web/portal/portalsite/index.php on line 97


    Here is the code at line 311 in core.php:

    foreach($initMods as $mod_title=>$mod_include){
    if (DEBUG_MODE)
    $GLOBALS['PHPWS_Timer']->setMarker("Begin Load $mod_title Objects");
    if (is_array($mod_include["init_object"])){
    foreach ($mod_include["init_object"] as $object_name=>$class_name){
    if (!isset($_SESSION[$object_name]) && class_exists($class_name)){
    if (is_array($mod_include["mod_sessions"]) && in_array($object_name, $mod_include["mod_sessions"]))
    $_SESSION[$object_name] = new $class_name;
    else
    $GLOBALS[$object_name] = new $class_name;
    }
    }
    }
    if (DEBUG_MODE)

    And Line 97 of index.php:

    foreach($includeList as $mod_title=>$current_mod_file) {
    if(DEBUG_MODE) {
    $PHPWS_Timer->setMarker("Begin $mod_title Execution");
    }

    Do I need to delete the DEBUG_MODE out of each file?
    I tried looking for the answer in docs and faq to no avail.

    Thanks,
    Zero B

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've never seen DEBUG_MODE, so I have no idea if that is messing things up for you.

    If your code blocks are complete you were missing some closing braces:

    PHP Code:
    foreach($initMods as $mod_title=>$mod_include)
    {
      if (
    DEBUG_MODE)
        
    $GLOBALS['PHPWS_Timer']->setMarker("Begin Load $mod_title Objects" );
      if(
    is_array($mod_include["init_object"]))
      {
        foreach (
    $mod_include["init_object"] as $object_name=>$class_name)
        {
          if(!isset(
    $_SESSION[$object_name]) && class_exists($class_name))
          {
            if(
    is_array($mod_include["mod_sessions"]) && in_array($object_name$mod_include["mod_sessions"]))
              
    $_SESSION[$object_name] = new $class_name;
            else
              
    $GLOBALS[$object_name] = new $class_name;
          }
        }
      }
    }

    if (
    DEBUG_MODE)

    And 
    Line 97 of index.php:

    foreach(
    $includeList as $mod_title=>$current_mod_file)
    {
      if(
    DEBUG_MODE)
      {
        
    $PHPWS_Timer->setMarker("Begin $mod_title Execution" );
      }

    John


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •