Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39
  1. #21
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by mesnitu View Post
    Thanks!!!
    Less one problem !
    The issue was on the modify file. It had this
    $list_box_contents ='';

    instead of this
    $list_box_contents = array();

    ... don't know why, probably some update that I miss.
    Now it ok !
    Good. Yes, php is becoming more stringent about properly identifying how a variable is intended to be used and basically validating that the data is the type expected to use as well as other improvements in the language.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #22
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Code:
    [13-Jan-2018 18:24:07 Europe/Lisbon] PHP Warning:  A non-numeric value encountered in /home/xxxxxx/public_html/includes/modules/pages/advanced_search_result/header_php.php on line 370
    The code:
    PHP Code:
    $rate $currencies->get_value($_SESSION['currency']);
    if (
    $rate) {
      
    $pfrom $_GET['pfrom'] / $rate;
      
    $pto $_GET['pto'] / $rate;

    I did check on git to see if there were updates on this , but I see no changes.
    Should I use a float($rate) ?

    Thanks
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  3. #23
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,403
    Plugin Contributions
    87

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by mesnitu View Post
    Code:
    [13-Jan-2018 18:24:07 Europe/Lisbon] PHP Warning:  A non-numeric value encountered in /home/xxxxxx/public_html/includes/modules/pages/advanced_search_result/header_php.php on line 370
    The code:
    PHP Code:
    $rate $currencies->get_value($_SESSION['currency']);
    if (
    $rate) {
      
    $pfrom $_GET['pfrom'] / $rate;
      
    $pto $_GET['pto'] / $rate;

    I did check on git to see if there were updates on this , but I see no changes.
    Should I use a float($rate) ?

    Thanks
    Nope, the issue there is that the pfrom/pto values, if not set in the form, come back as '' (a non-numeric value). Try the following instead:
    PHP Code:
    $rate $currencies->get_value($_SESSION['currency']);
    if (
    $rate) {
      
    $pfrom = ((float)$_GET['pfrom']) / $rate;
      
    $pto = ((float)$_GET['pto']) / $rate;


  4. #24
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... - PHP 7 warnings

    Thanks, I'll try that

  5. #25
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by torvista View Post

    Line 50 is pretty meaty so I'll leave this for those who seem to enjoy these challenges.......
    PHP Code:
    $format_string $this->currencies[$currency_type]['symbol_left'] . number_format(zen_round($number $rate$this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; 
    I added

    if (!is_numeric($number)) $number = 0;

    at line 46 in includes/classes/currencies.php
    Last edited by swguy; 27 May 2018 at 10:18 PM.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  6. #26
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    I added

    if (!is_numeric($number)) $number = 0;

    at line 46.
    ....in classes/currencies.php, to clarify.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  7. #27
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,625
    Plugin Contributions
    123

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Seen this a couple of times:

    [29-May-2018 07:16:10 America/Los_Angeles] PHP Warning: Creating default object from empty value in admin/product.php on line 224

    Fix is pretty straightforward - above line 224 in admin/product.php add

    if (!is_object($pInfo)) $pInfo = new StdClass();
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  8. #28
    Join Date
    Feb 2007
    Posts
    224
    Plugin Contributions
    0

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    I am having the same error
    PHP Warning: A non-numeric value encountered in ..../public_html/includes/classes/categories_ul_generator.php on line 73

    Line 73 is
    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
    Coming from the block code
    if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
    }
    $result .= $this->child_end_string;

    What is the fix for this error?
    zen cart 1.5.5f
    Last edited by TamyA; 20 Jul 2018 at 10:41 PM. Reason: More detailes

  9. #29
    Join Date
    Jul 2012
    Posts
    16,719
    Plugin Contributions
    17

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by TamyA View Post
    I am having the same error
    PHP Warning: A non-numeric value encountered in ..../public_html/includes/classes/categories_ul_generator.php on line 73

    Line 73 is
    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
    Coming from the block code
    if (($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
    $result .= $this->buildBranch($category_id, $level+1, $submenu, $category_link . '_');
    }
    $result .= $this->child_end_string;

    What is the fix for this error?
    zen cart 1.5.5f
    Change line 58 of the file from:
    Code:
    $level = $level;
    To:
    Code:
    $level = (int)$level;
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: PHP Warning: A non-numeric value encountered... admin, currencies.php

    Quote Originally Posted by mc12345678 View Post
    Change line 58 of the file from:
    Code:
    $level = $level;
    To:
    Code:
    $level = (int)$level;
    Sorry, more than likely will need to add the above at or around line 58 so that $level will be forced to be an integer. In newer php versions it is/will be possible to cast/expect the value to be an integer, but to maintain the existing backwards compatibility the above was the way chosen.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 3 of 4 FirstFirst 1234 LastLast

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

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