Advertisement:

Author Topic: [2.0.15][2.1 Beta 3]Function matchPackageVersion(): typo in key type_major  (Read 723 times)

Offline davidhs

  • Sr. Member
  • ****
  • Posts: 966
  • Gender: Male
At this moment I am adding support for SMF 2.1 Beta 1, 2 and 3 to all my own mods and function matchPackageVersion() do not uses the beta number correctly.
Quote
compareVersions('2.1 Beta 1', '2.1 Beta 2') => MATCH
Code: [Select]
$versions = (
    [1] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 0 // MUST BE 1
            [type_minor] => 0
            [dev] =>
        )
    [2] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 0 // MUST BE 2
            [type_minor] => 0
            [dev] =>
        )
)

compareVersions('2.1 Beta 1.3', '2.1 Beta 2') => NOT MATCH BUT THERE IS AN ERROR
Code: [Select]
$versions = (
    [1] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 1
            [type_minor] => 3
            [dev] =>
        )
    [2] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 0 // MUST BE 2
            [type_minor] => 0
            [dev] =>
        )
)

Version SMF: 2.0.15 & 2.1 Beta 3
File: Sources/Subs-Package.php
Function: matchPackageVersion()
Line: 1507 (2.0.15) & 1661 (2.1 Beta 3)
Code: (search) [Select]
'type_major' => !empty($parts[6]) ? (int) $parts[5] : 0,
Code: (replace) [Select]
'type_major' => !empty($parts[5]) ? (int) $parts[5] : 0,
And now...
Quote
compareVersions('2.1 Beta 1', '2.1 Beta 2') => NOT MATCH
Code: [Select]
$versions = (
    [1] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 1
            [type_minor] => 0
            [dev] =>
        )
    [2] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 2
            [type_minor] => 0
            [dev] =>
        )
)

compareVersions('2.1 Beta 1.3', '2.1 Beta 2') => NOT MATCH
Code: [Select]
$versions = (
    [1] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 1
            [type_minor] => 3
            [dev] =>
        )
    [2] => Array
        (
            [major] => 2
            [minor] => 1
            [patch] => 0
            [type] => beta
            [type_major] => 2
            [type_minor] => 0
            [dev] =>
        )
)