Last modified: 2012-02-07 23:51:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T36203, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 34203 - [Regression] UnknownAction hook problem: the hook should pass the raw action value and not the one core uses ("nosuchaction")
[Regression] UnknownAction hook problem: the hook should pass the raw action ...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.20.x
All All
: High blocker (vote)
: 1.19.0 release
Assigned To: Nobody - You can work on this!
https://www.mediawiki.org/wiki/Extens...
:
Depends on:
Blocks: 34161
  Show dependency treegraph
 
Reported: 2012-02-04 21:15 UTC by T. Gries
Modified: 2012-02-07 23:51 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description T. Gries 2012-02-04 21:15:25 UTC
I found (at least) in Extension:WikiArticleFeeds the problem, that an url like

&action=feed&feed=atom

calls the hook with value action == nosuchaction .

This is a deviation from previous behavious (I would say, serious).
Pls. correct me, if I am wrong, or can you correct the problem in core ?
Comment 1 T. Gries 2012-02-04 22:03:43 UTC
Analysis part:

when using the (admittedly) deprecated, but still present UnknownAction hook, it returns currently 'nosuchaction' - and Extensions which hooks on an &action=feed value will fail 

because


in wiki.php getAction() is called, and getActionName() returns $act == 'nosuchaction' . This overwrites the &action=xyz value the hook should have a chance to see, instead, it passes 'nosuchaction' to the hook.

wiki.php:

when called with &action=feed (as example; I added a debug output)

480     $act = $this->getAction(); /// $act = 'nosuchaction' and overwriting our 'feed' value
480a    wfDebug( "Wiki:performAction:act = $act\n" );
481 	
482 	$action = Action::factory( $act, $page );
483 	if ( $action instanceof Action ) {
484 	$action->show();
485 	wfProfileOut( __METHOD__ );
486 	return;
487 	}
488 	
488a    // the hook sees 'nosuchaction' instead of 'feed'
489 	if ( wfRunHooks( 'UnknownAction', array( $act, $page ) ) ) {
490 	$output->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
491 	}
492 	

I am not courageous and competent enough to fix this in this very core part.
Please can anyone of your core developers fix it ?

The debug log proves my analysis:

GET /phase3/index.php?title=Sandbox2&action=feed&feed=rss
Wiki:performAction:act = nosuchaction <<< wrong; should be 'feed'
Comment 2 T. Gries 2012-02-04 22:11:08 UTC
The problem is in Article:getActionName() , which returns 'nosuchaction' but the UnknownAction hook should be called _before_ an (internally) unknown action value gets overwritten.
Comment 3 T. Gries 2012-02-05 10:39:54 UTC
Link added as reference on https://www.mediawiki.org/wiki/Manual:Hooks/UnknownAction - so that potential users of the deprecated hook are pointed to here.
Comment 4 T. Gries 2012-02-05 11:01:12 UTC
fixed in r110716

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links