Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r20869: LJSUP-10888 (exception in S2: Method cal...

Committer: ailyin
LJSUP-10888 (exception in S2: Method called on null User object)
U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2011-12-28 11:48:51 UTC (rev 20868)
+++ trunk/cgi-bin/LJ/S2.pm	2011-12-28 12:28:21 UTC (rev 20869)
@@ -134,8 +134,13 @@
         $page = $cv->($u, $remote, $opts);
     }
 
+    return if $opts->{'badfriendgroup'};
+    return if $opts->{'handler_return'};
+    return if $opts->{'readonlyremote'};
+    return if $opts->{'readonlyjournal'};
+    return if $opts->{'redir'};
     return if $opts->{'suspendeduser'};
-    return if $opts->{'handler_return'};
+    return if $opts->{'suspendedentry'};
 
     # the friends mode=live returns raw HTML in $page, in which case there's
     # nothing to "run" with s2_run.  so $page isn't runnable, return it now.
@@ -143,6 +148,20 @@
     # like print_stylesheet() won't run, which don't have an method invocant
     return $page if $page && ref $page ne 'HASH';
 
+    if ( $entry =~ /::/ && !$page ) {
+        # object methods 
+        my $url = 'http://' . LJ::Request->hostname . LJ::Request->uri;
+        if ( my $args = LJ::Request->args ) {
+            $url .= '?' . $args;
+        }
+
+        my $opts_keys = join( q{, }, sort keys %$opts );
+
+        die "no page object for $entry, url=$url, opts keys=$opts_keys " . 
+            '(check Perl constructor in the relevant LJ::S2::*Page ' .
+            'class first)';
+    }
+
     s2_run($r, $ctx, $opts, $entry, $page);
 
     if (ref $opts->{'errors'} eq "ARRAY" && @{$opts->{'errors'}}) {
@@ -2081,10 +2100,10 @@
         'views_order' => [ 'recent', 'archive', 'friends', 'userinfo' ],
         'global_title' =>  LJ::ehtml($u->{'journaltitle'} || $u->{'name'}),
         'global_subtitle' => LJ::ehtml($u->{'journalsubtitle'}),
-        'head_content' => LJ::S2::HeadContent::->new({ u      => $u,
-                                                       remote => $remote,
-                                                       type   => 'Page',
-                                                       opts   => $opts, }),
+        'head_content' => LJ::S2::HeadContent->new({ u      => $u,
+                                                     remote => $remote,
+                                                     type   => 'Page',
+                                                     opts   => $opts, }),
         'data_link' => {},
         'data_links_order' => [],
         'showspam' => $get->{mode} eq 'showspam' && LJ::is_enabled('spam_button')

Tags: ailyin, andy, livejournal, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments