Recent Topics

1 Feb 15, 2008 23:32    

Fatal error when posting anchor tags without being logged in

Got this from one of my users the other day - if you leave a comment with an anchor tag in it via the default setting, you get a fatal error assuming your not logged in. I never hit, since I'm always logged in.

Anyhow, the fix I put in place for now is:

Index: inc/_core/_param.funcs.php
===================================================================
--- inc/_core/_param.funcs.php  (revision 49)
+++ inc/_core/_param.funcs.php  (revision 50)
@@ -1753,7 +1753,7 @@
 
        if( $error )
        {
-               if( $current_User->check_perm( 'users', 'edit', false ) )
+               if( isset($current_User) && is_object($current_User) && $current_User->check_perm( 'users', 'edit', false ) )
                {
                        $Messages->add( sprintf( T_('(Note: To get rid of the above validation warnings, you can deactivate unwanted validation rules in your <a %s>Group settings</a>.)'),
                                                                                'href="?ctrl=users&amp;grp_ID='.$Group->ID.'"' ), 'error' );

A more accurate fix would be an instanceof (PHP5) or is_a (PHP4) check or at least a method_exists() once it's determined that there is a real object in that value instead of null.

An even better long term fix is that the $current_User is always set with an anonymous user if no one is logged in...


Form is loading...