Throw an exception if calling parent or self on MWFunction.
authorX! <soxred93@users.mediawiki.org>
Mon, 3 Jan 2011 20:19:51 +0000 (20:19 +0000)
committerX! <soxred93@users.mediawiki.org>
Mon, 3 Jan 2011 20:19:51 +0000 (20:19 +0000)
includes/MWFunction.php

index 0756ad2..8c646f6 100644 (file)
@@ -30,6 +30,14 @@ class MWFunction {
                        }
                }
                
+               $callback = (array) $callback;
+               
+               if( count( $callback ) == 2 && $callback[0] == 'self' || $callback[0] == 'parent' ) {
+                       
+                       throw new MWException( 'MWFunction cannot call self::method() or parent::method()' );
+                       
+               }
+               
                // Run autoloader (workaround for call_user_func_array bug: http://bugs.php.net/bug.php?id=51329)
                is_callable( $callback );