Bugzilla – Attachment 154279 Details for
Bug 34435
get_password_expiry_date should not modify its parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34435: Remove side effect from get_password_expiry_date
Bug-34435-Remove-side-effect-from-getpasswordexpir.patch (text/plain), 1.37 KB, created by
Jonathan Druart
on 2023-08-04 13:39:47 UTC
(
hide
)
Description:
Bug 34435: Remove side effect from get_password_expiry_date
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-08-04 13:39:47 UTC
Size:
1.37 KB
patch
obsolete
>From ee90cff97005759a1295d23bbbf018f1b5040c6d Mon Sep 17 00:00:00 2001 >From: emlam <emily.lamancusa@montgomerycountymd.gov> >Date: Thu, 27 Jul 2023 16:36:34 +0000 >Subject: [PATCH] Bug 34435: Remove side effect from get_password_expiry_date > >If get_password_expiry_date is passed a DateTime object >as a parameter, it modifies and returns the original >object. This can create possible side effects. > >This patch modifies get_password_expiry_date to clone the >DateTime object that it receives as a parameter and >return the modified clone, so that object references can >be passed in safely. > >To test: >prove t/db_dependent/Koha/Patron/Category.t > >Signed-off-by: Sam Lau <samalau@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > Koha/Patron/Category.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index 335367b825d..e24c8d6e79c 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -126,7 +126,7 @@ sub get_password_expiry_date { > my ($self, $date ) = @_; > if ( $self->password_expiry_days ) { > $date ||= dt_from_string; >- $date = dt_from_string( $date ) unless ref $date; >+ $date = ref $date ? $date->clone() : dt_from_string( $date ); > return $date->add( days => $self->password_expiry_days )->ymd; > } else { > return; >-- >2.25.1
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 34435
:
153998
|
153999
|
154100
|
154101
|
154278
| 154279