Action::factory: Don't crash on missing Action classes
authorRoan Kattouw <roan.kattouw@gmail.com>
Thu, 17 Mar 2016 00:39:54 +0000 (17:39 -0700)
committerRoan Kattouw <roan.kattouw@gmail.com>
Thu, 17 Mar 2016 00:39:54 +0000 (17:39 -0700)
Show the "no such action" error message instead.

Normally I wouldn't favor putting this in here, but it's way
too easy to register a missing class by accident, see my rant
on T107921#2128080.

Bug: T107921
Change-Id: I56da8a5810cae3547a0c8f2d3f435dfd790fbeaf

includes/actions/Action.php

index ead8efa..839d7b2 100644 (file)
@@ -96,6 +96,9 @@ abstract class Action {
                $classOrCallable = self::getClass( $action, $page->getActionOverrides() );
 
                if ( is_string( $classOrCallable ) ) {
+                       if ( !class_exists( $classOrCallable ) ) {
+                               return false;
+                       }
                        $obj = new $classOrCallable( $page, $context );
                        return $obj;
                }