https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44067

--- Comment #3 from John Vinke <[email protected]> ---
Created attachment 211519
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211519&action=edit
Bug 44067: Don't leak the strings flag into sibling embeds in to_api

Koha::Object::to_api sets $params->{strings} inside the embed loop on
the shared $params hashref. Once an embed requesting +strings is
processed (e.g. periods+strings on ERM agreements), every embed iterated
after it also gets a _strings attribute. Hash iteration order is random
per process, so this happens intermittently depending on the Plack
worker.

The ERM agreement form sends the fetched related records back on save,
so the stray _strings on user_roles, agreement_licenses,
agreement_relationships or documents is rejected by the API with
"Properties not allowed: _strings."

This patch gives each embed its own copy of $params so the strings flag
only applies to the embed that requested it.

Test plan:
1. Create an ERM agreement with a user, a license, a related agreement
   and/or a document
2. Edit the agreement and click Save. Repeat several times
=> FAIL: "Something went wrong: Error: Properties not allowed: _strings."
   on some attempts
3. Apply this patch, restart_all
4. Repeat 2
=> SUCCESS: The agreement saves every time

Signed-off-by: John Vinke <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to