Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37
  1. #1
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Parameter must be an array or an object that implements Countable in fec.php

    I am using fast and easy checkout. I am getting the following errors when i upgraded to php7.2

    [29-Dec-2019 02:45:53 America/New_York] PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/inverter/public_html/includes/classes/observers/class.fec.php on line 101
    [29-Dec-2019 12:08:19 America/New_York] PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/inverter/public_html/includes/classes/observers/class.fec.php on line 111
    [29-Dec-2019 12:09:34 America/New_York] PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/inverter/public_html/includes/classes/observers/class.fec.php on line 111

    I have enclosed the class.fec.php file where the errors are coming from. If someone could assist me in getting this fixed


    PHP Code:
    <?php


    //


    // +----------------------------------------------------------------------+


    // |zen-cart Open Source E-commerce                                       |


    // +----------------------------------------------------------------------+


    // | Copyright (c) 2007-2008 Numinix Technology http://www.numinix.com    |


    // |                                                                      |


    // | Portions Copyright (c) 2003-2006 Zen Cart Development Team           |


    // | 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: class.fec.php 109 2010-04-28 05:47:55Z numinix $


    //


    /**


     * Observer class used to redirect to the FEC page


     *


     */


    class FECObserver extends base 


    {


        function 
    FECObserver()


        {


            global 
    $zco_notifier;


            
    $zco_notifier->attach($this, array('NOTIFY_HEADER_START_CHECKOUT_SHIPPING'));


        
    $zco_notifier->attach($this, array('NOTIFY_HEADER_END_CHECKOUT_PAYMENT'));


        }



        function 
    update(&$class$eventID$paramsArray) {


        global 
    $messageStack


        if (
    FEC_STATUS == 'true') {


          
    $error false;


          if (
    $_GET['main_page'] == FILENAME_CHECKOUT_PAYMENT and sizeof($messageStack->messages) > 0) {


            
    $error true;


            for (
    $i=0$n=sizeof($messageStack->messages); $i<$n$i++) {


              if (
    $messageStack->messages[$i]['class'] == 'checkout_payment') {


                
    $checkout_payment_output[] = $messageStack->messages[$i];


              }


              if (
    $messageStack->messages[$i]['class'] == 'redemptions') {


                
    $redemptions_output[] = $messageStack->messages[$i];


              }


            }


            
    $messageStack->reset();


            if (
    sizeof($checkout_payment_output) > 0) {


              for (
    $i=0$n=sizeof($checkout_payment_output); $i<$n$i++) {


                
    $messageStack->add_session('checkout_payment'strip_tags($checkout_payment_output[$i]['text']), 'error');


              }


            }


            if (
    sizeof($redemptions_output) > 0) {


              for (
    $i=0$n=sizeof($redemptions_output); $i<$n$i++) {


                
    $messageStack->add_session('redemptions'strip_tags($redemptions_output[$i]['text']), 'caution');


              }


            }


          }  


          if (
    $_GET['credit_class_error']) {


            
    $error true;


            
    $messageStack->add_session('checkout_payment'htmlspecialchars(urldecode($_GET['credit_class_error'])), 'error');


          }


          if (
    $error) {


            
    zen_redirect(zen_href_link(FILENAME_CHECKOUT"fecaction=null"'SSL'));


          } else {


            
    zen_redirect(zen_href_link(FILENAME_CHECKOUT'''SSL'));


          }


        }


        }


    }


    // eof

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,489
    Plugin Contributions
    88

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    Perhaps (?) at the top of the update method, initialize those two arrays:

    Code:
    $checkout_payment_output = array();
    $redemptions_output = array();

  3. #3
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    not sure what you mean by
    $checkout_payment_output = array();
    $redemptions_output = array();.

    DO i put that at the top of the page?

  4. #4
    Join Date
    Jan 2007
    Posts
    1,484
    Plugin Contributions
    10

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    after
    PHP Code:
    function update(&$class$eventID$paramsArray) { 


        global 
    $messageStack

    Zen Cart and it's community are the best!!

  5. #5
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    i think I got a little lost here. WHere do i put the code

    $checkout_payment_output = array();
    $redemptions_output = array();.


    and this

    function update(&$class, $eventID, $paramsArray) {


    global $messageStack;

  6. #6
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    i see this is what i did

    function update(&$class, $eventID, $paramsArray) {


    global $messageStack;


    $checkout_payment_output = array();
    $redemptions_output = array();



    if (FEC_STATUS == 'true') {

  7. #7
    Join Date
    Jan 2007
    Posts
    1,484
    Plugin Contributions
    10

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    and did that fix the issue?

    Zen Cart and it's community are the best!!

  8. #8
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Re: Parameter must be an array or an object that implements Countable in fec.php

    seems to have solved the issue. I will followup if i see any issue in the log

  9. #9
    Join Date
    Jan 2015
    Posts
    423
    Plugin Contributions
    0

    Default Upgrade notice [FEC]Parameter must be an array or an object that implements Countable

    Zencart 1.5.7
    Php 7.4

    I am currently in the upgrade process from 5.6 to 5.7.

    I use FEC fast and easy checkout. I cant seem to solve this error. If some could help that would be great.


    Error
    HTML Code:
    --> PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\xxxxxx.com\includes\templates\theme871\templates\tpl_checkout_stacked.php on line 313.
    This is the line of code on line 313. This is where i am getting confused. I am not sure how to make the changes.

    Code:
    else {
    for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    this is just the full piece of code in case i missed something
    Code:
     <?php }
    
                                  else {
    
                                      for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
    
                                      // set the radio button to be checked if it is the method chosen
    
                                          $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) ? true : false);
    
    
                                          if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
    
                                              //echo '      <div id="defaultSelected" class="moduleRowSelected">' . "\n";
    
                                          //} else {
    
                                              //echo '      <div class="moduleRow">' . "\n";
    
                                          }
    
                                  ?>
    
                              <?php

  10. #10
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Upgrade Question - Parameter must be an array or an object that implements Counta

    Need code prior to that as '$quotes[$i]['methods']' is not "properly" set to be an array or something "countable"... It could be that it isn't set at all, but wouldn't really know unless the earlier code were reviewed...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 4 123 ... LastLast

Similar Threads

  1. Replies: 3
    Last Post: 24 Dec 2019, 08:16 AM
  2. Replies: 11
    Last Post: 21 Dec 2018, 09:06 PM
  3. Replies: 7
    Last Post: 16 Dec 2018, 04:00 PM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR