object in the object_before_delete hook is not always blesssed

RESOLVED INVALID

Status

()

Bugzilla
Extensions
RESOLVED INVALID
5 years ago
4 years ago

People

(Reporter: sushant.srivastav, Unassigned)

Tracking

Details

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.79 Safari/537.1

Steps to reproduce:

In my extensions code I implemented the object_before_delete like so: 
sub object_before_delete {
    my ($self, $object) = @_;
    $object->isa('Bugzilla::..')...
}


Actual results:

Bugzilla hook object_before_delete documents that I can test the object for reference using isa, however when I try to delete a flag, it throws error saying the reference is not blessed.


Expected results:

It shouldn't throw any error for unblessed reference
(Reporter)

Updated

5 years ago
Priority: -- → P2

Comment 1

5 years ago
(do not set the priority yourself)
Keywords: qawanted
Priority: P2 → --

Comment 2

4 years ago
Your code is wrong. It must be:

sub object_before_delete {
    my ($self, $args) = @_;
    my $object = $args->{'object'};

i.e. the 2nd argument is not the object itself, but a hashref containing the object.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Keywords: qawanted
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.