Results 1 to 10 of 39

Threaded View

  1. #1
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,803
    Plugin Contributions
    31

    Default [Done v1.5.6] PHP Warning: A non-numeric value encountered... - PHP 7 warnings

    I have had a couple of these debug warnings with PHP 7.1. No doubt there will be more...

    1) in advanced_search_result_header.php

    I changed

    $rate = $currencies->get_value($_SESSION['currency']);
    if ($rate) {
    $pfrom = $_GET['pfrom'] / $rate;
    $pto = $_GET['pto'] / $rate;}
    to
    $rate = $currencies->get_value($_SESSION['currency']);
    if ($rate) {
    $pfrom = (float)$_GET['pfrom'] / $rate;//steve added float for PHP 7 warning
    $pto = (float)$_GET['pto'] / $rate;//steve added float for PHP 7 warning
    }
    Note this was provoked by an url like this
    SHOP_ROOT/index.php?main_page=advanced_search_result&keyword=asas&search_in_description=1& categories_id=&inc_subcat=1&manufacturers_id=&pfrom=&pto=&dfrom=&dto=

    2) functions_taxes.php

    I changed
    // Calculates Tax rounding the result function
    zen_calculate_tax($price, $tax = 0) {
    $price = $price;
    $tax = $tax;
    //eof global $currencies;
    return $price * $tax / 100;
    }
    to
    // Calculates Tax rounding the result
    function zen_calculate_tax($price, $tax = 0) {
    $price = (float)$price; //steve added float for PHP 7 warning
    $tax = (float)$tax; //steve added float for PHP 7 warning
    //eof global $currencies;
    return $price * $tax / 100;
    }
    Last edited by torvista; 1 Aug 2017 at 11:01 AM.
    Steve
    github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

 

 

Similar Threads

  1. Replies: 1
    Last Post: 15 Dec 2018, 10:54 PM
  2. Replies: 2
    Last Post: 18 Nov 2018, 04:06 AM
  3. Replies: 0
    Last Post: 18 Feb 2018, 06:26 PM
  4. Replies: 20
    Last Post: 7 Dec 2014, 11:29 AM
  5. Replies: 0
    Last Post: 27 Sep 2012, 11:57 PM

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