Index: trunk/phase3/includes/Hooks.php |
— | — | @@ -119,6 +119,18 @@ |
120 | 120 | global $wgOut; |
121 | 121 | $wgOut->showFatalError($retval); |
122 | 122 | return false; |
| 123 | + } elseif( $retval === null ) { |
| 124 | + if( is_array( $callback ) ) { |
| 125 | + if( is_object( $callback[0] ) ) { |
| 126 | + $prettyClass = get_class( $callback[0] ); |
| 127 | + } else { |
| 128 | + $prettyClass = strval( $callback[1] ); |
| 129 | + } |
| 130 | + $prettyFunc = $prettyClass . '::' . strval( $callback[1] ); |
| 131 | + } else { |
| 132 | + $prettyFunc = strval( $callback ); |
| 133 | + } |
| 134 | + throw new MWException( "Invalid NULL return from broken hook $prettyFunc" ); |
123 | 135 | } else if (!$retval) { |
124 | 136 | return false; |
125 | 137 | } |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -92,6 +92,9 @@ |
93 | 93 | * (bug 9328) Use "revision-info-current" message in place of "revision-info" |
94 | 94 | when viewing the current revision of a page, if available |
95 | 95 | * (bug 8890) Enable wiki text for "license" message |
| 96 | +* Throw a showstopper exception when a hook function fails to return a value. |
| 97 | + Forgetting to give a 'true' return value is a very common error which tends |
| 98 | + to cause hard-to-track-down interactions between extensions. |
96 | 99 | |
97 | 100 | == Bugfixes since 1.10 == |
98 | 101 | |