Closed Bug 523762 Opened 16 years ago Closed 16 years ago

template-before_process hook causes infinite recursion if it throws an error

Categories

(Bugzilla :: Extensions, defect, P1)

Tracking

()

RESOLVED FIXED
Bugzilla 3.6

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

(Whiteboard: [es-ita])

Attachments

(1 file, 3 obsolete files)

Bugzilla::Error uses Template::process to throw errors, so if the template-before_process hook itself throws an error, you get an infinite recursion.
Summary: Template::before_process hooks causes infinite recursion if it throws an error → Template::before_process hook causes infinite recursion if it throws an error
Summary: Template::before_process hook causes infinite recursion if it throws an error → template-before_process hook causes infinite recursion if it throws an error
Actually, I think this is a more general problem--namely that hooks can recurse infinitely a bit too easily. However, SOMETIMES you might want a hook to recurse, in limited circumstances. I can't think of what they would be, but I assume it could happen.
Attached patch v1 (obsolete) — Splinter Review
Okay, here's a fairly elegant solution to the problem. For now I'm limiting it to the template-before_process hook, because we can actually tell pretty well whether we want to allow recursion or not.
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #407709 - Flags: review?(dkl)
Blocks: 525606
Attached patch v2 (obsolete) — Splinter Review
I realized that hook recursion would also be overwriting hook_args, so I've fixed that in this version. (Technically that's a bug that could affect the branches as well, but I haven't heard anybody mention it yet and it's quite a complex fix.)
Attachment #407709 - Attachment is obsolete: true
Attachment #409480 - Flags: review?(dkl)
Attachment #407709 - Flags: review?(dkl)
Attached patch v3 (obsolete) — Splinter Review
I'd forgotten the Bugzilla.pm part of the patch.
Attachment #409480 - Attachment is obsolete: true
Attachment #409481 - Flags: review?(dkl)
Attachment #409480 - Flags: review?(dkl)
Whiteboard: [es-ita]
Severity: normal → major
Component: Bugzilla-General → Extensions
Attached patch v4Splinter Review
Here we go. This fixes the bitrot and is much simpler than the old patch.
Attachment #409481 - Attachment is obsolete: true
Attachment #415300 - Flags: review?(dkl)
Attachment #409481 - Flags: review?(dkl)
Priority: -- → P1
Comment on attachment 415300 [details] [diff] [review] v4 Looks good and solved the recursion problem in my test cases. r=dkl
Attachment #415300 - Flags: review?(dkl) → review+
Flags: approval+
Checking in Bugzilla/Hook.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Hook.pm,v <-- Hook.pm new revision: 1.46; previous revision: 1.45 done Checking in Bugzilla/Template.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v <-- Template.pm new revision: 1.122; previous revision: 1.121 done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: