Simple Machines Community Forum

SMF Development => Bug Reports => Topic started by: dougiefresh on October 31, 2014, 06:33:10 PM

Title: version check in package code
Post by: dougiefresh on October 31, 2014, 06:33:10 PM
I'd like to make a bug report.  In Subs-Package.php, I keep seeing this error:
Quote
http://my.site/index.php?action=admin;area=packages;sa=browse
Apply Filter: Only show the errors with the same message
8: Undefined offset: 1
Apply Filter: Only show the errors from this file
File: /home/xptspn5/public_html/site/board/Sources/Subs-Package.php
Line: 1506

That line is in this statement (line causing error is highlighted in red):
Quote
      $versions[$id] = array(
         'major' => (int) $parts[1],
         'minor' => !empty($parts[2]) ? (int) $parts[2] : 0,
         'patch' => !empty($parts[3]) ? (int) $parts[3] : 0,
         'type' => empty($parts[4]) ? 'stable' : $parts[4],
         'type_major' => !empty($parts[6]) ? (int) $parts[5] : 0,
         'type_minor' => !empty($parts[6]) ? (int) $parts[6] : 0,
         'dev' => !empty($parts[7]),
      );
I've changed my copy to read like this (change is highlighted in red):
Quote
      $versions[$id] = array(
         'major' => !empty($parts[1]) ? (int) $parts[1] : 0,
         'minor' => !empty($parts[2]) ? (int) $parts[2] : 0,
         'patch' => !empty($parts[3]) ? (int) $parts[3] : 0,
         'type' => empty($parts[4]) ? 'stable' : $parts[4],
         'type_major' => !empty($parts[6]) ? (int) $parts[5] : 0,
         'type_minor' => !empty($parts[6]) ? (int) $parts[6] : 0,
         'dev' => !empty($parts[7]),
      );
This gets rid of the error message that keeps popping up when I install mods on my forum when this mod is installed.

Hope this helps....
Title: Re: version check in package code
Post by: Arantor on October 31, 2014, 06:45:42 PM
Well, here's the thing... I don't call the version check routine in this mod, so if it's broken, it's not actually related to this mod, and I wouldn't be surprised if it fails on a fresh 2.0.9 with whatever mod can't actually set its version properly.
Title: Re: version check in package code
Post by: dougiefresh on October 31, 2014, 08:19:58 PM
Whoops! ....  I'm sorry.  I just looked inside the mod package and that line isn't in the mod....  Damn....  Can this bug report be split off from this thread and inserted into the bug reports area?  Thanks very much!
Title: Re: version check in package code
Post by: Kindred on May 29, 2015, 10:18:56 AM
I finally noticed this and split it...

However, I don't think this is actually a bug...   mods **MUST** set the major version that they support so there should never be a case where this is triggered.
Title: Re: version check in package code
Post by: live627 on May 29, 2015, 06:59:37 PM
According to the mod log, this was split from Sortable Packages (and Installed Time) (http://www.simplemachines.org/community/index.php?topic=355665.0)]
Title: Re: version check in package code
Post by: Kindred on May 29, 2015, 08:40:02 PM
Yes, it was... But, the code noted is core code, not mod code
Title: Re: version check in package code
Post by: live627 on May 30, 2015, 07:55:24 PM
Was just noting for future reference so readers won't be confused when reading this thread out of context.