Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Posts
    6
    Plugin Contributions
    0

    Default Error: Argument #2 is not an array in .../httpdocs/admin/infopages2.php

    [FONT=Verdana][FONT=&quot]Zencart 1.2.6
    This is second hand, I've had it given to me to fix and I can't make heads nor tails of it.
    The [product] image does not appear when the page is opened. I have opened the 'edit infopages 2' (up next to the date/time) but the following error appears:[/FONT]
    [/FONT]
    [FONT=Verdana][FONT=&quot]Warning[/FONT][FONT=&quot]: array_merge() [function.array-merge]: Argument #2 is not an array in .../httpdocs/admin/infopages2.php on line 241

    Warning: reset() [function.reset]: Passed variable is not an array or object in .../httpdocs/admin/includes/classes/object_info.php on line 29

    Warning: Variable passed to each() is not an array or object in .../httpdocs/admin/includes/classes/object_info.php on line 30[/FONT]
    [/FONT]

    [FONT=Verdana][FONT=&quot]I have tried to add a new file to replace the file that won't open - it also wont delete.

    I just realised I had somehow posted this in User Contributions, no idea how I managed that. I was wondering why 2 weeks had not seen any replies. Anyway, reposted here, hope someone can help me work out why I'm getting this.
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    //  $Id: INFOPAGES2.php 2005-2-19
    //
      require('includes/application_top.php');
      $action = (isset($_GET['action']) ? $_GET['action'] : '');
      if (zen_not_null($action)) {
        switch ($action) {
          case 'setflag':
            if ( ($_GET['flag'] == '0') || ($_GET['flag'] == '1') ) {
              zen_set_page_status2($_GET['bID'], $_GET['flag']);
              $messageStack->add_session(SUCCESS_PAGE_STATUS_UPDATED, 'success');
            } else {
              $messageStack->add_session(ERROR_UNKNOWN_STATUS_FLAG, 'error');
            }
            zen_redirect(zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']));
            break;
          case 'insert':
          case 'update':
            if (isset($_POST['pages_id'])) $pages_id = zen_db_prepare_input($_POST['pages_id']);
            $pages_title = zen_db_prepare_input($_POST['pages_title']);
            $pages_html_text = zen_db_prepare_input($_POST['pages_html_text']);
            $alt_url = zen_db_prepare_input($_POST['alt_url']);        
               $pages_vertical_sort_order = (int)zen_db_prepare_input($_POST['vertical_sort_order']);
               $pages_horizontal_sort_order = (int)zen_db_prepare_input($_POST['horizontal_sort_order']);
            
            
            $page_error = false;
            if (empty($pages_title)) {
              $messageStack->add(ERROR_PAGE_TITLE_REQUIRED, 'error');
              $page_error = true;
            }
            if (empty($pages_html_text)) {
            }
            if ($page_error == false) {
              $sql_data_array = array('pages_title' => $pages_title,
                            'alt_url' => $alt_url,
                            'vertical_sort_order' => $pages_vertical_sort_order,
                            'horizontal_sort_order' => $pages_horizontal_sort_order,                        
                                       'pages_html_text' => $pages_html_text);
              if ($action == 'insert') {
                // r.l. add into language       beginn
                $insert_sql_data = array('status' => '1',
                                        'languages_id' => $_SESSION['languages_id']);
                // r.l. add into language       end
                $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
                zen_db_perform(TABLE_INFOPAGES2, $sql_data_array);    
                $pages_id = zen_db_insert_id();
                $messageStack->add_session(SUCCESS_PAGE_INSERTED, 'success');
              } elseif ($action == 'update') {
                zen_db_perform(TABLE_INFOPAGES2, $sql_data_array, 'update', "pages_id = '" . (int)$pages_id . "'");
                $messageStack->add_session(SUCCESS_PAGE_UPDATED, 'success');
              }
     
     
     
    
     
     
     
     
              zen_redirect(zen_href_link(FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'bID=' . $pages_id));
            } else {
              $action = 'new';
            }
            break;
          case 'deleteconfirm':
            $pages_id = zen_db_prepare_input($_GET['bID']);
            $db->Execute("delete from " . TABLE_INFOPAGES2 . " where pages_id = '" . (int)$pages_id . "'");
            $messageStack->add_session(SUCCESS_PAGE_REMOVED, 'success');
            zen_redirect(zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page']));
            break;
        }
      }
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    <title><?php echo TITLE; ?></title>
    <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
    <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
    <script language="javascript" src="includes/menu.js"></script>
    <script language="javascript" src="includes/general.js"></script>
    <script type="text/javascript">
      <!--
      function init()
      {
        cssjsmenu('navbar');
        if (document.getElementById)
        {
          var kill = document.getElementById('hoverJS');
          kill.disabled = true;
        }
      if (typeof _editor_url == "string") HTMLArea.replaceAll();
      }
      // -->
    </script>
    <?php if (HTML_EDITOR_PREFERENCE=="FCKEDITOR") require(DIR_WS_INCLUDES.'fckeditor.php'); ?>
    <?php if (HTML_EDITOR_PREFERENCE=="HTMLAREA")  require(DIR_WS_INCLUDES.'htmlarea.php'); ?>
    </head>
    <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    <!-- body //-->
    <table border="0" width="100%" cellspacing="2" cellpadding="2">
      <tr>
    <!-- body_text //-->
        <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
                <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
              </tr>
            </table></td>
          </tr>
    <?php
      if ($action == 'new') {
        $form_action = 'insert';
    
        $parameters = array('pages_title' => '',
                            'languages_id' => $_SESSION['languages_id'],    // r.l. languages       beginn , end
                            'pages_html_text' => '',
                            'alt_url' => '',                        
                            'vertical_sort_order' => '',
                            'horizontal_sort_order' => '',                                                
                            'status' =>'');
    
        $bInfo = new objectInfo($parameters);
    
        if (isset($_GET['bID'])) {
          $form_action = 'update';
    
          $bID = zen_db_prepare_input($_GET['bID']);
    
          $page_query = "select * from " . TABLE_INFOPAGES2 . " where pages_id = '" . $_GET['bID'] . "'";
          $page = $db->Execute($page_query);
          $bInfo->objectInfo($page->fields);
        } elseif (zen_not_null($_POST)) {
          $bInfo->objectInfo($_POST);
        }
    ?>
          <tr>
            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
          </tr>
          <tr><?php echo zen_draw_form('new_page', FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'action=' . $form_action, 'post', 'enctype="multipart/form-data"'); if ($form_action == 'update') echo zen_draw_hidden_field('pages_id', $bID); ?>
            <td><table border="0" cellspacing="0" cellpadding="2">
              <tr>
                <td class="main"><?php echo TEXT_PAGES_TITLE; ?></td>
                <td class="main"><?php echo zen_draw_input_field('pages_title', $bInfo->pages_title, '', true); ?></td>
              </tr>
              <tr>
                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              <tr>
                <td valign="top" class="main"><?php echo TEXT_PAGES_HTML_TEXT; ?></td>
                <td class="main"><?php echo zen_draw_textarea_field('pages_html_text', 'soft', '80', '20', $bInfo->pages_html_text); ?></td>
              </tr>
                                   
              <tr>
                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
              
              <tr>
                <td class="main"><?php echo TEXT_ALT_URL; ?></td>
                <td class="main"><?php echo zen_draw_input_field('alt_url', $bInfo->alt_url); 
                                echo '<br />' . TEXT_ALT_URL_EXPLAIN;
                        ?></td>
              </tr>
                        
              <tr>
                <td class="main"><?php echo TEXT_VERTICAL_SORT_ORDER; ?></td>
                <td class="main"><?php echo zen_draw_input_field('vertical_sort_order', $bInfo->vertical_sort_order); 
                                echo '<br />' . TEXT_VSORT_ORDER_EXPLAIN;
                        ?></td>
              </tr>
              
              <tr>
                <td class="main"><?php echo TEXT_HORIZONTAL_SORT_ORDER; ?></td>
                <td class="main"><?php echo zen_draw_input_field('horizontal_sort_order', $bInfo->horizontal_sort_order); 
                                    echo '<br />' . TEXT_HSORT_ORDER_EXPLAIN;
                        ?></td>
              </tr>
                    
              <tr>
                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
                                            
            </table></td>
          </tr>
          <tr>
            <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
          </tr>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td colspan="2" class="main" align="left" valign="top" nowrap><?php echo (($form_action == 'insert') ? zen_image_submit('button_insert.gif', IMAGE_INSERT) : zen_image_submit('button_update.gif', IMAGE_UPDATE)). '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_INFOPAGES2, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . (isset($_GET['bID']) ? 'bID=' . $_GET['bID'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
              </tr>
            </table></td>
          </form></tr>
    <?php
      } else {
    ?>
          <tr>
            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr class="dataTableHeadingRow" width="100%">
                    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PAGES; ?></td>
                    <td class="dataTableHeadingContent"></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_VSORT_ORDER; ?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_HSORT_ORDER; ?></td>                
                  </tr>
    
    <?php
        $pages_query_raw = "select pages_id, pages_title, status,vertical_sort_order,horizontal_sort_order from " . TABLE_INFOPAGES2 . " WHERE languages_id={$_SESSION['languages_id']} order by vertical_sort_order, horizontal_sort_order, pages_title";
        $pages_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $pages_query_raw, $pages_query_numrows);
        $pages = $db->Execute($pages_query_raw);
    
    while (!$pages->EOF) {
         if ((!isset($_GET['bID']) || (isset($_GET['bID']) && ($_GET['bID'] == $pages->fields['pages_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
            $bInfo_array = array_merge($pages->fields, $info);
            $bInfo = new objectInfo($bInfo_array);
          }
          if (isset($bInfo) && is_object($bInfo) && ($pages->fields['pages_id'] == $bInfo->pages_id)) {
            echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id']) . '\'">' . "\n";
          } else {
            echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id']) . '\'">' . "\n";
          }
    ?>
                    <td class="dataTableContent"><?php echo '&nbsp;' . $pages->fields['pages_title']; ?></td>
                    <td class="dataTableContent" align="right"></td>
                    <td class="dataTableContent" align="center">
    <?php
          if ($pages->fields['status'] == '1') {
            echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', 'Active', 10, 10) . '&nbsp;&nbsp;<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id'] . '&action=setflag&flag=0') . '">' . zen_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', 'Set Inactive', 10, 10) . '</a>';
          } else {
            echo '<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $pages->fields['pages_id'] . '&action=setflag&flag=1') . '">' . zen_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', 'Set Active', 10, 10) . '</a>&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', 'Inactive', 10, 10);
          }
    ?></td>
                    <td class="dataTableContent" align="center"><?php echo '&nbsp;' . $pages->fields['vertical_sort_order']; ?></td>
                    <td class="dataTableContent" align="center"><?php echo '&nbsp;' . $pages->fields['horizontal_sort_order']; ?></td>
                  </tr>
    <?php
    
     $pages->MoveNext();
        }
    ?>
                      <tr>
                        <td class="smallText" valign="top"><?php echo $pages_split->display_count($pages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PAGES); ?></td>
                        <td class="smallText" align="right"><?php echo $pages_split->display_links($pages_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'info', 'x', 'y', 'lID'))); ?></td>
                      </tr>
    
    
                  <tr>
                    <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                      <tr>
                        <td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'action=new') . '">' . zen_image_button('button_new_file.gif', IMAGE_NEW_PAGE) . '</a>'; ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
    <?php
      $heading = array();
      $contents = array();
      switch ($action) {
        case 'delete':
          $heading[] = array('text' => '<b>' . $bInfo->pages_title . '</b>');
    
          $contents = array('form' => zen_draw_form('pages', FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=deleteconfirm'));
          $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
          $contents[] = array('text' => '<br><b>' . $bInfo->pages_title . '</b>');
    
          $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
          break;
        default:
          if (is_object($bInfo)) {
            $heading[] = array('text' => '<b>' . $bInfo->pages_title . '</b>');
    
            $contents[] = array('align' => 'center', 'text' => '<br><br><a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=new') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_INFOPAGES2, 'page=' . $_GET['page'] . '&bID=' . $bInfo->pages_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br><br><br>');
    
            if ($bInfo->date_scheduled) $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_SCHEDULED_AT_DATE, zen_date_short($bInfo->date_scheduled)));
    
            if ($bInfo->expires_date) {
              $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_EXPIRES_AT_DATE, zen_date_short($bInfo->expires_date)));
            } elseif ($bInfo->expires_impressions) {
              $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_EXPIRES_AT_IMPRESSIONS, $bInfo->expires_impressions));
            }
    
            if ($bInfo->date_status_change) $contents[] = array('text' => '<br>' . sprintf(TEXT_PAGES_STATUS_CHANGE, zen_date_short($bInfo->date_status_change)));
          }
          break;
      }
    
      if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
        echo '            <td width="25%" valign="top">' . "\n";
    
        $box = new box;
        echo $box->infoBox($heading, $contents);
    
        echo '            </td>' . "\n";
      }
    ?>
              </tr>
            </table></td>
          </tr>
    <?php
      }
    ?>
        </table></td>
    <!-- body_text_eof //-->
      </tr>
    </table>
    <!-- body_eof //-->
    
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    <br>
    </body>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
    I've had a brief look through the files in question, but it's all a bit incomprehensible to me.
    As always, if anyone can give me a hand in the right direction, it would be hugely appreciated.
    [/FONT]
    [/FONT]

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Error: Argument #2 is not an array in .../httpdocs/admin/infopages2.php

    User Contributions is probably the right place to be posting this query. I suspect that the reason you're not getting a response is because the question refers to an add-on to an old version of Zen cart that has been superceded by a function now included in core code. So the number of people with experience of it is probably rather small, and the number of them who can remember anything about it, even smaller.

    On this particular problem, you might want to ask what's changed, as this cart must have been running for a substantial time without this problem, and some change must have triggered it.

    In general though, this problem is going to be the least of this cart's issues. As PHP4 has come to the end of its life and will not be supported after December, web hosts are likely to be switching to PHP5 (some have started). Old carts like this aren't built for a much later version of PHP and will fall over completely, unless upgraded in time.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Nov 2004
    Location
    Deal, Kent, UK
    Posts
    332
    Plugin Contributions
    0

    Default Re: Error: Argument #2 is not an array in .../httpdocs/admin/infopages2.php

    This should solve it...

    Change line 237 in infopages2.php from:
    $bInfo_array = array_merge($pages->fields, $info);

    To:
    $bInfo_array = $pages->fields;

    Found this in an old thread as I just encountered the same problem and fixed it.

  4. #4
    Join Date
    Jun 2007
    Posts
    6
    Plugin Contributions
    0

    Default Re: Error: Argument #2 is not an array in .../httpdocs/admin/infopages2.php

    Yup, that did the trick. Thanks a truckload, your a life saver!

  5. #5
    Join Date
    Nov 2004
    Location
    Deal, Kent, UK
    Posts
    332
    Plugin Contributions
    0

    Default Re: Error: Argument #2 is not an array in .../httpdocs/admin/infopages2.php

    You're welcome - saved me too!

 

 

Similar Threads

  1. Warning: array_merge() [function.array-merge]: Argument #1 is not an array
    By antieuclid in forum PayPal Express Checkout support
    Replies: 3
    Last Post: 19 Jul 2010, 02:50 AM
  2. Replies: 19
    Last Post: 14 Dec 2009, 01:17 PM
  3. Replies: 1
    Last Post: 2 Oct 2008, 11:01 PM
  4. Replies: 1
    Last Post: 14 Mar 2008, 02:58 AM
  5. Error: Argument #1 is not an array in
    By Fuzion in forum Managing Customers and Orders
    Replies: 2
    Last Post: 2 Feb 2008, 07:57 AM

Posting Permissions

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