Topic on Extension talk:LDAP Authentication

Jump to navigation Jump to search

LDAP Authentication extention to registration not working

8
131.203.91.54 (talkcontribs)

Hi

I am trying to get LdapAuthentication extension work with my upgraded MediaWiki. Our previous setup was

Product Version
MediaWiki 1.24.4
PHP 5.6.30 (apache2handler)
MySQL 5.6.16
Apache 2.4.16
OS Windows Server 2012R2

The LdapAuthentication worked fine with the above version of MediaWiki.

Once we upgraded to the newer version, and I am getting errors below.

MediaWiki 1.28.0
PHP 7.0.15 (apache2handler)
MySQL 5.6.0
Apache 2.4.25
OS Windows Server 2012R2

I am trying to run convertExtensionToRegistration.php on LdapAuthentication and I get the following error:

C:\PHP\php.exe : Error: Global functions cannot be converted to JSON. Please move the handler for LoadExtensionSchemaUpdates inside a class.

At line:1 char:1

This does create an extension file but when I run update.php I get the following error:

C:\PHP\php.exe : [2ede5ca9f218d5e8ed5d0e2a] [no req]   MWException from line 176 of E:\Websites\MediaWiki\includes\Hooks.php: Invalid callback 

efLdapAuthenticationSchemaUpdates in hooks for LoadExtensionSchemaUpdates

At line:1 char:1

+ C:\PHP\php.exe .\maintenance\update.php

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: ([2ede5ca9f218d5...onSchemaUpdates:String) [], RemoteException

    + FullyQualifiedErrorId : NativeCommandError 

Backtrace:

#0 E:\Websites\MediaWiki\includes\installer\DatabaseUpdater.php(122): Hooks::run(string, array)

#1 E:\Websites\MediaWiki\includes\installer\DatabaseUpdater.php(187): DatabaseUpdater->__construct(DatabaseMysqli, boolean, UpdateMediaWiki)

#2 E:\Websites\MediaWiki\maintenance\update.php(171): DatabaseUpdater::newForDB(DatabaseMysqli, boolean, UpdateMediaWiki)

#3 E:\Websites\MediaWiki\maintenance\doMaintenance.php(111): UpdateMediaWiki->execute()

#4 E:\Websites\MediaWiki\maintenance\update.php(217): require_once(string)

#5 {main}

Can anyone please help with this?

Jbrekelbaum (talkcontribs)

I am also having the same problem on 1.28.

Sorvis (talkcontribs)

I just realized that upgrading my PHP version from 5.5 to 7 breaks this extension. When I roll back to 5.5 it starts working again. I am using mediawiki 1.28

2003:72:6D2A:9E00:E09F:A580:49D6:2D05 (talkcontribs)

The error

> Error: Global functions cannot be converted to JSON. Please move the handler for LoadExtensionSchemaUpdates inside a class.

means that in LdapAuthentication.php the hook LoadExtensionSchemaUpdates is used. For this hook, function efLdapAuthenticationSchemaUpdates() is called and the problem with this is, that this function is inside LdapAuthentication.php.

The fix for this error is this:

  • Move this function into a different file and there put it inside a class.
  • Then adjust the hook definition so that it is calling the class function.
Osnard (talkcontribs)

Why would you run convertExtensionToRegistration.php? Are you a developer and want to contribute to code base of the extension? Because this script is not meant to be run as part of a setup. It is a development tool to ease code migration.

LdapAuthentication should run with MediaWiki 1.28 even though it does not have an extension.json file. You just need to use the old require_once instead of wfLoadExtension.

When using PHP7, are there any error_log entries that give a hint on what exactly goes wrong?

96.94.241.41 (talkcontribs)

I'm seeing this error as well. I'm getting "Failed to bind" error in the debug for the extension. I'm using php7.0 and mediawiki 1.27. Was working just fine couple weeks ago. I did just update so not sure if a newer version of php7 is breaking something.

2003:72:6D13:B800:9DA1:D2BF:3590:31AE (talkcontribs)

wfLoadExtension() is the new way of loading extensions and plan is to one day remove support for the old require_once() way of doing things. Using convertExtensionToRegistration.php is the recommended way of bringing an extension up to date again. As already note above:


  • Move this function into a different file and there put it inside a class.
  • Then adjust the hook definition so that it is calling the class function.

That definitely is a step in the right direction and possibly already is enough to get the migration to wfLoadExtension() working for this extension.

Osnard (talkcontribs)

That's totally true but makes only sense if this change finds its way back to the upstream. So please, if you successfully migrate to extension.json commit that change to the code review process of the extension.

Reply to "LDAP Authentication extention to registration not working"