Skip Menu |

This queue is for tickets about the Object-InsideOut CPAN distribution.

Report information
The Basics
Id: 30527
Status: resolved
Priority: 0/
Queue: Object-InsideOut

People
Owner: Nobody in particular
Requestors: dkoch [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 3.26
Fixed in: 3.29



Subject: Monkey-patching UNIVERSAL::isa breaks contract
This monkey patch to UNIVERSAL::isa *UNIVERSAL::isa = sub { my ($thing, $type) = @_; # Want classes? if (! $type) { return $thing->Object::InsideOut::meta()->get_classes(); } goto $GBL{'isa'}; }; Breaks this code in Rose::HTML::Form::Field::Group -- in the line below, $class or $group_class may be false, and your patched version of isa blindly tries to call Object::InsideOut::meta() on $arg, which is not appropriate: if(UNIVERSAL::isa($arg, $class) || UNIVERSAL::isa($arg, $group_class)) ... You patch needs to do further checking on $thing to see that it can(Object::InsideOut::meta), or eval the call. Thanks!
From: JDHEDDEN [...] cpan.org
Thanks for catching this. I have uploaded a new version of OIO that fixes this issue.
Subject: Re: [rt.cpan.org #30527] Monkey-patching UNIVERSAL::isa breaks contract
Date: Tue, 06 Nov 2007 21:08:46 -0500
To: bug-Object-InsideOut [...] rt.cpan.org
From: Daniel Koch <dkoch [...] mm.st>
Jerry D. Hedden via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=30527 > > > Thanks for catching this. I have uploaded a new version of OIO that > fixes this issue. > >
Thanks so much for the quick fix! Dan Koch
I just downloaded 3.28, but the problem still exists. I have attached a testcase. I have a mod_perl environment, and some Object::InsideOut classes are loaded into the Apache process. The monkey-patched version of UNIVERSAL::isa is interfering with the behavior of a class unrelated to Object::InsideOut, specifically where the unrelated class is expecting UNIVERSAL::isa($object, undef) to return false, but instead is getting an exception thrown by the version of UNIVERSAL::isa inserted by Object::InsideOut.
Download oio_isa_testcase.tar.gz
application/gzip 570b

Message body not shown because it is not plain text.

DKOCH wrote: Show quoted text
> I just downloaded 3.28, but the problem still exists.
Sorry about that. Seems there were 2 places I needed to make changes, and I missed one. Show quoted text
> I have attached a testcase.
Thanks. That was very helpful. I incorporated similar tests into the test suite. Of note, however, is that your test has brought to light a bug in Perl. It seems that if UNIVERSAL::isa is chained, and goto is used for the chaining, and UNIVERSAL::isa is called with undef for the second argument, it produces erroneous warnings. I have submitted this as the following bug report: http://rt.perl.org/rt3/Public/Bug/Display.html?id=47233 I recommend checking for undef first when calling UNIVERSAL::isa. Here is one possible workaround: UNIVERSAL::isa($thing, $class || ''); I will upload the fixed version of OIO shortly. Thanks for your patiences and assistance.