Bugzilla – Attachment 141590 Details for
Bug 31684
Plugin versions starting with a "v" cause unnecessary warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings
Bug-31684-Plugin-versions-starting-with-a-v-cause-.patch (text/plain), 1.47 KB, created by
David Nind
on 2022-10-10 20:47:11 UTC
(
hide
)
Description:
Bug 31684: Plugin versions starting with a "v" cause unnecessary warnings
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-10-10 20:47:11 UTC
Size:
1.47 KB
patch
obsolete
>From 2b8f05292825965b9764598090c7dcd9d3298351 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 17 Mar 2021 10:44:31 -0400 >Subject: [PATCH] Bug 31684: Plugin versions starting with a "v" cause > unnecessary warnings > >Our code assumes that plugin version will be purely numeric ( e.g. 1.2.3 ) but many plugin authors ( including myself ) use the format "v1.2.3". >This causes warnings as we use a numeric comparison on the version numbers. >It could make sense to check for and strip any v's from the beginning of the version. > >Test Plan: >1) Apply the first patch to set the test plugin's version to v1.01 >2) prove t/db_dependent/Koha/Plugins/Plugins.t >3) Note the warnings and test failures >4) Apply this patch >5) prove t/db_dependent/Koha/Plugins/Plugins.t >6) All tests pass! > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Plugins/Base.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/Plugins/Base.pm b/Koha/Plugins/Base.pm >index 92ce7714bd..487a3dc5e2 100644 >--- a/Koha/Plugins/Base.pm >+++ b/Koha/Plugins/Base.pm >@@ -326,6 +326,11 @@ sub _version_compare { > # 0.0.0 <=> 0.2.1 = -1 > push( @v1, 0 ) unless defined( $v1[$i] ); > push( @v2, 0 ) unless defined( $v2[$i] ); >+ >+ # Strip letters before comparing, supresses 'Argument "v1" isn't numeric in int' warning >+ $v1[$i] =~ s/^v//g; >+ $v2[$i] =~ s/^v//g; >+ > if ( int( $v1[$i] ) > int( $v2[$i] ) ) { > return 1; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31684
:
141379
|
141380
|
141589
|
141590
|
142292
|
142293