News: When asking for support, it helps us and you, if you read the Posting Guidelines

Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media
Welcome, Guest. Please login or register.
Did you miss your activation email?

April 08, 2020, 03:49:00 AM

Login with username, password and session length

Recent

Members
  • Total Members: 3777
  • Latest: Mike
Stats
  • Total Posts: 189583
  • Total Topics: 20808
  • Online Today: 65
  • Online Ever: 917
  • (January 21, 2020, 09:02:26 AM)
Users Online
Users: 0
Guests: 38
Total: 38

Author Topic: Numeric Error Bugs - PHP 7.1  (Read 817 times)

0 Members and 1 Guest are viewing this topic.

Offline tino

  • Developer
  • *
  • Posts: 1738
Numeric Error Bugs - PHP 7.1
« on: June 20, 2018, 12:16:37 PM »
These seem to have been missed at some point  :-[

Code: [Select]
Apply Filter: Only show the error messages of this member Guest
Apply Filter: Only show the error messages of this IP address 87.185.75.27   
    Reverse chronological order of list Today at 04:44:53 PM
Apply Filter: Only show the error messages of this session ec893a61bd4b2972f2b654b62c5e20ca
Apply Filter: Only show the errors of this type Type of error: General
Apply Filter: Only show the error messages of this URLhttps://www.fedupwithliberals.com/index.php?&action=profile;area=tparticles;u=1Apply Filter: Only show the errors with the same message2: A non-numeric value encounteredApply Filter: Only show the errors from this file File: /home/delta5/public_html/Sources/TPmodules.php
Line: 1231


1212:            art.author_id as authorID, art.category, art.locked   
1213:         FROM {db_prefix}tp_articles AS art
1214:         WHERE art.author_id = {int:auth}
1215:         ORDER BY art.{raw:sort} DESC LIMIT {int:start}, 10',
1216:         array('auth' => $memID, 'sort' => $sorting, 'start' => $start)
1217:      );
1218:     
1219:      if($smcFunc['db_num_rows']($request) > 0){
1220:         while($row = $smcFunc['db_fetch_assoc']($request))
1221:         {
1222:            $rat = array();
1223:            $rating_votes = 0;
1224:            $rat = explode(',', $row['rating']);
1225:            $rating_votes = count($rat);
1226:            if($row['rating'] == '')
1227:               $rating_votes = 0;
1228:   
1229:            $total = 0;
1230:            foreach($rat as $mm => $mval)
==>1231:               $total = $total + $mval;
1232:   
1233:            if($rating_votes > 0 && $total > 0)
1234:               $rating_average = floor($total / $rating_votes);
1235:            else
1236:               $rating_average = 0;
1237:           
1238:

Offline lurkalot

  • Administrator
  • *
  • Posts: 6474
    • Camera Craniums
Re: Numeric Error Bugs - PHP 7.1
« Reply #1 on: June 20, 2018, 12:38:19 PM »
Yes I saw that reported over at the other place.  Is this a php 7.1 /7.2 thing, just I thought Pete = Arantor caught most of those errors a while back.  Obviously not this one. 

Offline tino

  • Developer
  • *
  • Posts: 1738
Re: Numeric Error Bugs - PHP 7.1
« Reply #2 on: June 20, 2018, 12:40:59 PM »
Yes I saw that reported over at the other place.  Is this a php 7.1 /7.2 thing, just I thought Pete = Arantor caught most of those errors a while back.  Obviously not this one.

Yeh it’s a PHP7.1/2 thing, I checked and it was fixed in a load of places. Just missed here and somewhere else. I don’t think I undid it when merging the responsive code but I might off. Either way it will be fixed in TP 1.5.1

I don’t think TP should support 7.2 yet mainly as SMF has a fit when I try it on that version.

Offline lurkalot

  • Administrator
  • *
  • Posts: 6474
    • Camera Craniums
Re: Numeric Error Bugs - PHP 7.1
« Reply #3 on: June 20, 2018, 12:49:11 PM »
Yes I saw that reported over at the other place.  Is this a php 7.1 /7.2 thing, just I thought Pete = Arantor caught most of those errors a while back.  Obviously not this one.

Yeh it’s a PHP7.1/2 thing, I checked and it was fixed in a load of places. Just missed here and somewhere else. I don’t think I undid it when merging the responsive code but I might off. Either way it will be fixed in TP 1.5.1

I don’t think TP should support 7.2 yet mainly as SMF has a fit when I try it on that version.

I agree tino, no point supporting a php version which SMF doesn't..  Thanks for adding fix to next version.  Pete kindly stepped in and kindly offered those fixes, he could well have missed it. https://www.tinyportal.net/index.php?topic=35895.0

Offline lurkalot

  • Administrator
  • *
  • Posts: 6474
    • Camera Craniums
Re: Numeric Error Bugs - PHP 7.1
« Reply #4 on: June 20, 2018, 01:02:07 PM »
I'm assuming it's also the same issue that was discussed here, https://www.tinyportal.net/index.php?topic=35959.msg290969#msg290969

Offline tino

  • Developer
  • *
  • Posts: 1738
Re: Numeric Error Bugs - PHP 7.1
« Reply #5 on: June 20, 2018, 01:42:03 PM »
I'm assuming it's also the same issue that was discussed here, https://www.tinyportal.net/index.php?topic=35959.msg290969#msg290969

Yup, there is loads of copy and paste code, so loads of places to change it seems. Should rationalise the code really.