Bugzilla – Attachment 152609 Details for
Bug 31393
Koha::Config->read_from_file incorrectly parses elements with 1 attribute named" content" (Shibboleth config)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31393: Use _content as a placeholder when parsing koha-conf.xml
Bug-31393-Use-content-as-a-placeholder-when-parsin.patch (text/plain), 2.34 KB, created by
David Cook
on 2023-06-23 03:01:54 UTC
(
hide
)
Description:
Bug 31393: Use _content as a placeholder when parsing koha-conf.xml
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-06-23 03:01:54 UTC
Size:
2.34 KB
patch
obsolete
>From 21583f83d553f872fa46455731fd3012d630278e Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 23 Jun 2023 02:49:42 +0000 >Subject: [PATCH] Bug 31393: Use _content as a placeholder when parsing > koha-conf.xml > >This patch uses '_content' instead of 'content' as a placeholder >when parsing koha-conf.xml, so that elements with a "content" >attribute don't get parsed incorrectly (like with shibboleth config). > >Test plan: >0. Apply patch >1. echo 'flush_all' | nc -q 1 memcached 11211 >2. koha-plack --reload kohadev >3. Add Shibboleth config to koha-conf.xml > <shibboleth> > <matchpoint>userid</matchpoint> <!-- koha borrower field to match upon --> > <mapping> > <userid is="eduPersonID"></userid> <!-- koha borrower field to shibboleth attribute mapping --> > <branchcode content="foo"/> > </mapping> > </shibboleth> >4. vi Koha/Config.pm >5. Dump out the $config from the read_from_file() function >6. Note that the following is shown: >'branchcode' => { > 'content' => 'foo' > } >7. Note that the following is NOT shown: >'branchcode' => 'foo' >8. git restore Koha/Config.pm >9. Rejoice! > >For bonus points, you can actually do a full SAML test and make sure >the Shibboleth integration works as expected >--- > Koha/Config.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/Config.pm b/Koha/Config.pm >index eb0671dc2e..56883955be 100644 >--- a/Koha/Config.pm >+++ b/Koha/Config.pm >@@ -217,7 +217,7 @@ sub _read_from_dom_node { > my ($class, $node, $config) = @_; > > if ($node->nodeType == XML_TEXT_NODE) { >- $config->{content} = $node->textContent; >+ $config->{_content} = $node->textContent; > } elsif ($node->nodeType == XML_ELEMENT_NODE) { > my $subconfig = {}; > >@@ -239,9 +239,9 @@ sub _read_from_dom_node { > delete $subconfig->{id}; > } else { > my @keys = keys %$subconfig; >- if (1 == scalar @keys && $keys[0] eq 'content') { >+ if (1 == scalar @keys && $keys[0] eq '_content') { > # An element with no attributes and no child elements becomes its text content >- $subconfig = $subconfig->{content}; >+ $subconfig = $subconfig->{_content}; > } elsif (0 == scalar @keys) { > # An empty element becomes an empty string > $subconfig = ''; >-- >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 31393
:
152609
|
152685
|
157768
|
158060