Fix RT#52898, __MOP__ removal breaking debug screen with C::P::Session
Tomas Doran [Fri, 18 Dec 2009 19:55:03 +0000 (19:55 +0000)]
Changes
lib/Catalyst/Engine.pm
t/aggregate/error_page_dump.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index 79551fe..c70d6db 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@
   Bug fixes:
    - Remove the erroneous --detach option from Catalyst::Script::FastCGI
    - --daemon option to Catalyst::Script::FastCGI is fixed.
+   - Fix the debug dump for applications which use Catalyst::Plugin::Session
+     (RT#52898)
 
 5.80016 2009-12-11 23:23:33
 
index b0a7014..c881d55 100644 (file)
@@ -115,7 +115,7 @@ sub _dump_error_page_element {
     # This is fugly, but the metaclass is _HUGE_ and demands waaay too much
     # scrolling. Suggestions for more pleasant ways to do this welcome.
     local $val->{'__MOP__'} = "Stringified: "
-        . $val->{'__MOP__'} if exists $val->{'__MOP__'};
+        . $val->{'__MOP__'} if ref $val eq 'HASH' && exists $val->{'__MOP__'};
 
     my $text = encode_entities( dump( $val ));
     sprintf <<"EOF", $name, $text;
diff --git a/t/aggregate/error_page_dump.t b/t/aggregate/error_page_dump.t
new file mode 100644 (file)
index 0000000..099f8da
--- /dev/null
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+
+use Catalyst::Engine;
+
+my $m = sub { Catalyst::Engine->_dump_error_page_element(@_) };
+
+lives_ok { $m->('Scalar' => ['foo' => 'bar']) };
+lives_ok { $m->('Array' => ['foo' => []]) };
+lives_ok { $m->('Hash' => ['foo' => {}]) }; 
+
+done_testing;
+