Difference between revisions of "Extension talk:ImageHistoryClear"
From Organic Design wiki
m |
(more notes) |
||
Line 10: | Line 10: | ||
:The second error is that you've tried to access $wgOut before it's properly initialised - you should be accessing it from the callback function registered with the ''OutputPageBeforeHTML'' hook. | :The second error is that you've tried to access $wgOut before it's properly initialised - you should be accessing it from the callback function registered with the ''OutputPageBeforeHTML'' hook. | ||
:--[[User:Nad|nad]] 18:22, 24 October 2008 (NZDT) | :--[[User:Nad|nad]] 18:22, 24 October 2008 (NZDT) | ||
+ | |||
+ | You should really be executing the condition in the extension setup function or the class constructor not in the global scope (also the global keyword is redundant since you're already in global scope there). Also there doesn't appear to be any such function as ''egImageHistoryClear'' which you've assigned to the hook. --[[User:Nad|nad]] 19:50, 24 October 2008 (NZDT) |
Revision as of 06:50, 24 October 2008
Parser errors:
Notice: Undefined index: title in C:\www\wiki4\extensions\ImageHistoryClear\ImageHistoryClear.php on line 24
Notice: Undefined property: StubObject::$mBodytext in C:\www\wiki4\extensions\ImageHistoryClear\ImageHistoryClear.php on line 56
--Jack 17:33, 24 October 2008 (NZDT)
- The first error is due to the index "title" not existing in the array which since you're now using strict raises a warning, you'll need to encase the entire thing into a condition based on whether the title index exists (you can use isset() or in_array() ) and after that whether a title object could be made. Strict enforces safe coding practice which can be a bit tedious and verbose, but it solid and predictable.
- The second error is that you've tried to access $wgOut before it's properly initialised - you should be accessing it from the callback function registered with the OutputPageBeforeHTML hook.
- --nad 18:22, 24 October 2008 (NZDT)
You should really be executing the condition in the extension setup function or the class constructor not in the global scope (also the global keyword is redundant since you're already in global scope there). Also there doesn't appear to be any such function as egImageHistoryClear which you've assigned to the hook. --nad 19:50, 24 October 2008 (NZDT)