Open Bug 1805858 Opened 3 years ago Updated 1 year ago

Bug.pm with update : HASH ref while strict refs

Categories

(Bugzilla :: Creating/Changing Bugs, defect)

5.0.6
x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: w.pasman, Unassigned)

Details

Attachments

(1 obsolete file)

Linux 22LTS. Using the Bugzilla REST api to update a ticket.
Using python3 (default coming with linux) to create and send the request

I assume there is bugzilla running on localhost. And that there is a ticket that has id and alias ffffd337-2259-409e-9db6-d418cf1a19b3 (that is going to be updated)
I assume there is a user test@test.test with password *** in bugzilla.
Modify if your test configuration is different

reproduce by running this in python3:

import json
import requests
r = requests.get('http://localhost/bugzilla/rest/login?login=test@test.test&password=***')
token=json.loads(r.text)['token']
import requests;
update={"id_or_alias":"ffffd337-2259-409e-9db6-d418cf1a19b3", "assigned_to":"test@test.test","blocks":"","depends_on":"", "cc":"test@test.test", "comment":"A resource requires updating","status":"CONFIRMED"}
url = 'http://localhost/bugzilla/rest/'
u = url + "bug/ffffd337-2259-409e-9db6-d418cf1a19b3?token="+token
res=requests.put(u, json=update)
res.text

Expected:
a ticket update and a proper return message in res.text
Or, if there is an error, not a 200 return value.

Actual result:
The res shows "response 200" so it looks all OK
However the ticket is NOT updated.
If you inspect the actual res.text the story is very different

'{"code":100500,"documentation":"​https://bugzilla.readthedocs.org/en/5.0/api/","error":true,"message":"Can\'t use string ("A resouce requires updating.here
"...) as a HASH ref while"strict refs" in use at Bugzilla/WebService/Bug.pm line 649, <DATA> line 960.n"}'

So there at least 2 bugs it seems

  1. a response 200 while there is an error
  2. a bug in Bug.pm where some string is used as hash ref

BTW I tried changing the text in the comment field, and even left it out completely. It makes no difference, if I leave it out the code still tries to use a string, but now "", as a hash.

Note this seems identical to ​https://bugzilla.mozilla.org/show_bug.cgi?id=1331001 but that one was closed because the reporter noticed he forgot to set Content-Type to application/json. However setting Content-Type seems to not help. I have it set to text/plain but changing to application/json does not change anything.

After a lot of searching it seems that this bug is triggered by some untested assumptions made in Bug.pm
It seems assumed in Bug.pm, but not checked, that the "cc" field and "comment" field contain a dict/object with some fields.

Attachment #9386136 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: