[Bug 7630] New: Warning on moremember.pl about param without key
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 Bug #: 7630 Summary: Warning on moremember.pl about param without key Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P5 - low Component: Patrons AssignedTo: kyle.m.hall@gmail.com ReportedBy: m.de.rooy@rijksmuseum.nl QAContact: koha.sekjal@gmail.com CC: gmcharlt@gmail.com [Wed Feb 29 13:08:17 2012] [error] [client 82.173.53.17] [Wed Feb 29 13:08:17 2012] moremember.pl: Problem = a value of 1 has been passed to param without key at /usr/share/koha/testclone/C4/Templates.pm line 187. Whoever finds it first ... -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtompset@hotmail.com Severity|enhancement |minor --- Comment #1 from M. Tompsett <mtompset@hotmail.com> --- This is similar to bug 7352. However, I don't believe patron quick search is memberentry.pl I was going to enter something similar, but since I think that would be a duplicate of this problem, I'll add this commentary with my debugging hunt. C4::Template generated the following error log entry: [Mon Jun 04 11:50:36 2012] [error] [client 192.168.100.2] [Mon Jun 4 11:50:36 2012] moremember.pl: Problem = a value of 1 has been passed to param without key at /usr/share/koha/lib/C4/Templates.pm line 186., referer: https://.../cgi-bin/koha/members/memberentry.pl So I looked around line 186 of C4::Templates.pm if ( $key ) { $self->{VARS}->{$key} = $val; } else { warn "Problem = a value of $val has been passed to param without key"; } So I figured that moremember.pl must have $template->param( ... => 1 ... Line 145 in moremember.pl looked like a candidate, but I figured not. $_ would have some value most likely. I kept looking (/\$template->param). I skipped a few lines which had concatenations, because I was hoping they'd be initialized and not be the problem. That's when I found line 445 which has a number of parameters across many lines. One of them was $error (around line 466). $error => 1, I then decided to search for $error backwards (?\$error). That's when I saw the code of line 74: my $error = $input->param('error'); I then looked at memberentry.pl the only set of lines with moremember.pl mentioned are: $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber") : $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber") ; exit; # You can only send 1 redirect! After that, content or other headers don't matter. -- If someone noticed this before, why is it here? Also, notice there is no "&error=..." as well, so this isn't passing a value to $error. I figure that something similar to bug 6840 can be done in moremember.pl Split the $template->param() call: -- original ++ tweak $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, categoryname => $data->{'description'}, reregistration => $reregistration, branch => $branch, todaysdate => C4::Dates->today(), totalprice => sprintf("%.2f", $totalprice), totaldue => sprintf("%.2f", $total), totaldue_raw => $total, issueloop => @issuedata, relissueloop => @relissuedata, issuecount => $issuecount, relissuecount => $relissuecount, overdues_exist => $overdues_exist, - error => $error, - $error => 1, StaffMember => ($category_type eq 'S'), is_child => ($category_type eq 'C'), # reserveloop => \@reservedata, dateformat => C4::Context->preference("dateformat"), "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, samebranch => $samebranch, quickslip => $quickslip, ); ++$template->param(error => $error, $error => 1) if $error; -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 --- Comment #2 from M. Tompsett <mtompset@hotmail.com> --- Actually, the template file (moremember.tt) has an error check: [% IF ( error ) %] So, I wondered how does it handle undefined values or empty strings. I found my answer: http://my.safaribooksonline.com/book/programming/perl/0596004761/template-di... "If the result of this statement is 0 or "" (the empty string), test is considered to be false; everything else is true. Variables that have not been assigned a value, either with DEFAULT or SET, are considered to be false (the value of an undefined variable is an empty string)." I was contemplating if my potential patch was overkill, or would break templates. It would seem that it wouldn't, though perhaps a simpler solution is better: -- original ++ tweak $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, othernames => $data->{'othernames'}, categoryname => $data->{'description'}, reregistration => $reregistration, branch => $branch, todaysdate => C4::Dates->today(), totalprice => sprintf("%.2f", $totalprice), totaldue => sprintf("%.2f", $total), totaldue_raw => $total, issueloop => @issuedata, relissueloop => @relissuedata, issuecount => $issuecount, relissuecount => $relissuecount, overdues_exist => $overdues_exist, error => $error, - $error => 1, StaffMember => ($category_type eq 'S'), is_child => ($category_type eq 'C'), # reserveloop => \@reservedata, dateformat => C4::Context->preference("dateformat"), "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, samebranch => $samebranch, quickslip => $quickslip, ); ++$template->param($error => 1) if $error; -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 --- Comment #3 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 10563 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=10563&action=edit Proposed Patch to the BUG After getting a DEV install set up, I tweaked moremember.pl as described. To trigger the error: - Staff Client - Login - Patrons - Search for a patron somehow and then look at their details. - When moremember.pl is called, because there is no $error, it will trigger: [Fri Jun 29 21:37:32 2012] [error] [client 192.168.69.34] [Fri Jun 29 21:37:32 2012] moremember.pl: Problem = a value of 1 has been passed to param without key at /home/koha/kohaclone/C4/Templates.pm line 187., referer: http://192.168.69.37:8080/ By moving the "$error => 1" to a conditional $template->param(), the error log no longer gets spammed. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fred.pierre@smfpl.org --- Comment #4 from M. Tompsett <mtompset@hotmail.com> --- *** Bug 7352 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #10563|0 |1 is obsolete| | --- Comment #5 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 10581 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=10581&action=edit Bug 7630 - Warning on moremember.pl about param without key Move "$error => 1," to its own conditional $template->param() Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |chris@bigballofwax.co.nz -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Assignee|kyle.m.hall@gmail.com |mtompset@hotmail.com QA Contact|koha.sekjal@gmail.com |m.de.rooy@rijksmuseum.nl --- Comment #6 from M. de Rooy <m.de.rooy@rijksmuseum.nl> --- Good catch. Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |paul.poulain@biblibre.com Version|master |rel_3_8 --- Comment #7 from Paul Poulain <paul.poulain@biblibre.com> --- Patch pushed, welcome Mark, you're number #186 ! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #8 from Chris Cormack <chris@bigballofwax.co.nz> --- Pushed to 3.8.x, will be in 3.8.3 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7630 M. de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org