Last modified: 2008-11-14 22:16:49 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 T18242, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 16242 - InputBox SVN doesn't work with MediaWiki 1.14alpha SVN
InputBox SVN doesn't work with MediaWiki 1.14alpha SVN
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
InputBox (Other open bugs)
unspecified
All All
: Normal blocker (vote)
: ---
Assigned To: Trevor Parscal
: testme
: 16246 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-04 20:53 UTC by NSK Nikolaos S. Karastathis
Modified: 2008-11-14 22:16 UTC (History)
2 users (show)

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


Attachments

Description NSK Nikolaos S. Karastathis 2008-11-04 20:53:11 UTC
InputBox (Version r42791) does not work with MediaWiki 1.14alpha (r43105) and 1.14alpha (r43194) (I tested both revisions).  In short, InputBox SVN HEAD doesn't work with MediaWiki SVN HEAD.

No input box is outputted when trying to output one.

Previewing a page with an input box (which is not shown due to the bug) produced this php warning:

Warning: call_user_func_array() [function.call-user-func-array]: Unable to call InputBoxHooks::render() in /includes/parser/Parser.php on line 3330
Comment 1 NSK Nikolaos S. Karastathis 2008-11-04 20:56:08 UTC
The extension is installed in LocalSettings.php as follows:

require_once($IP.'/extensions/InputBox/InputBox.php');
Comment 2 Thomas Hempel 2008-11-06 16:46:41 UTC
This is easy to fix, and you can simplify the code. Basically get rid of the Inputbox.hooks.php.
1. In Inputbox.php replace everything from line 50 on with:

// Register parser hook
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
	// Modern
	$wgHooks['ParserFirstCallInit'][] = 'wfInputBox';
} else {
	// Legacy
	$wgExtensionFunctions[] = 'wfInputBox';
}

function wfInputBox ()
{
  new InputBox;
  return true;
}

2.In Inputbox.classes.php get rid of the __construct function and replace it with:
	function InputBox() {
	        global $wgParser;
		
		$wgParser->setHook( 'inputbox' , array( &$this, 'render' ) );
        }

	public function render( $input, $args, $parser ) {		
		$this->mParser = $parser;	       

		// Configure InputBox
		$this->extractOptions( $parser->replaceVariables( $input ) );

		// Return output
		return $this->render();
	}

and you're done!
Comment 3 Thomas Hempel 2008-11-06 17:06:42 UTC
sorry, there's a typo in the render() above, it should be:
	public function render( $input, $args, $parser ) {		
		$this->mParser = $parser;	       

		// Configure InputBox
		$this->extractOptions( $parser->replaceVariables( $input ) );


		// Internationalization
(continuing as before)
 tom
Comment 4 Woojin Kim 2008-11-07 08:07:27 UTC
*** Bug 16246 has been marked as a duplicate of this bug. ***
Comment 5 Brion Vibber 2008-11-14 00:08:59 UTC
This was probably due to changes in Hooks.php which I reverted in r43416.
Comment 6 Thomas Hempel 2008-11-14 00:25:39 UTC
No, it's still just as broken as ever. Same issue as before.
 tom
Comment 7 Brion Vibber 2008-11-14 00:26:13 UTC
Works just fine here. PHP version?
Comment 8 NSK Nikolaos S. Karastathis 2008-11-14 19:09:30 UTC
Thanks for looking at this.  Here it's mediawiki 1.14alpha (r43263), php 5.2.0-8+etch13 (apache2handler), mysql 5.0.32-Debian_7etch8-log.
Comment 9 Thomas Hempel 2008-11-14 20:08:48 UTC
Here's a simpler view of it. It's the same as an issue that Rob Church documented for Extension:RandomImage.
The problem is a statement of the form:
	$wgparser->setHook( 'randomimage', 'RandomImage::renderHook' );
Yhe problem goes away if you do:
	$wgParser->setHook( 'randomimage', array('RandomImage', 'renderHook'));
Hope that helps.
Comment 10 Brion Vibber 2008-11-14 21:52:09 UTC
Those are *function hooks* which are called directly with call_user_func_array() and must be a PHP callable.

Things in $wgHooks are *not* directly called; they are parsed and munged and, for backwards compatibility, we have retained that.

The relevant part of wfRunHooks() in Hooks.php is:

} elseif ( false !== ( $pos = strpos( $func, '::' ) ) ) {
	$callback = array( substr( $func, 0, $pos ), substr( $func, $pos + 2 ) );
} else {

This will translate the 'InputBoxHooks::register' into array('InputBoxHooks','register') which is the actual callable.

Can you confirm that you have a current version of both InputBox and MediaWiki trunk? Confirm that your Hooks.php is current, and does not have the broken version which broke these calls.

Can you then do some debugging to check the actual value of the callable at the time it's called in wfRunHooks()?
Comment 11 Brion Vibber 2008-11-14 21:57:11 UTC
Ahhhh it's the render, not the register that you're seeing. Your sample code referring to the *register* function's registration -- which is entirely set up correctly -- threw me off.

Fixed in r43504.
Comment 12 Thomas Hempel 2008-11-14 22:16:49 UTC
yes, that fixes it. Thanks!

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


Navigation
Links