Advertisement:

Author Topic: A non-numeric value encountered Pagination.php on line 42  (Read 222 times)

besiwims

  • Newbie
  • *
  • Posts: 3
A non-numeric value encountered Pagination.php on line 42
« on: January 28, 2019, 11:02:12 pm »
When I run osclass, I found these errors.

[28-Jan-2019 22:01:30 Africa/Johannesburg] PHP Warning: A non-numeric value encountered in /home2/wims/public_html/crypto-assets-market/oc-includes/osclass/classes/Pagination.php on line 42
[28-Jan-2019 22:01:30 Africa/Johannesburg] PHP Warning: A non-numeric value encountered in /home2/wims/public_html/crypto-assets-market/oc-includes/osclass/classes/Pagination.php on line 43

I replaced the lines with the code below and the errors were solved. I am not sure this is the best way as I do not know what the dynamic values of those 2 functions osc_search_page() and osc_search_total_pages()

$temp = 0;
           
            if(isset($params['total']))
            {
                if(is_numeric($params['total']))
                {
                    $temp = (int)$params['total'];
                }
                else
                {
                    //
                }
               
                $temp = $temp + 1 ;
            }
            else
            {
                $temp = is_numeric(osc_search_total_pages())? osc_search_total_pages() + 1 : 1;
            }
           
            $this->total              = $temp;
           
            $temp = 0;
           
            if(isset($params['selected']))
            {
                if(is_numeric($params['selected']))
                {
                    $temp = (int)$params['selected'];
                }
                else
                {
                    //
                }
               
                $temp = $temp + 1 ;
            }
            else
            {
                $temp = is_numeric(osc_search_page())? osc_search_page() + 1 : 1;
            }

            $this->selected           = $temp;

Thank you for correcting me.