Page MenuHomePhabricator

wgProxyList in 1.30 only shows white page
Closed, InvalidPublic

Description

Mediawiki - 1.30 - ProxyList - White page login connexion - How block ips list with mediawiki now ?

Official mediawiki page for $wgProxyList with my comment :
https://www.mediawiki.org/wiki/Manual_talk:$wgProxyList#White_page_with_mediawiki_1.30

With this first link, you can read that :
Work good with mediawiki 1.28 / 1.29 / 1.29.1

With mediawiki 1.30, the login page not work. White page.

When i comment this line, login page work good :

#require_once("$IP/extensions/bannedips.php");

Then, i suppose, this script not work with mediawiki 1.30

The french translation for the 1.30 mediawiki documentation say : L'utilisation d'un tableau associatif pour $wgProxyList, où l'adresse IP est dans la clé au lieu de la valeur, est déconseillée (par exemple ['127.0.0.1' => 'valeur']). Veuillez convertir ces tableaux en tableaux indexés / séquentiels (par exemple ['127.0.0.1']).

Then, replace the old method in this file /extensions/bannedips.php :

<?php
$wgProxyList = array(
'1.0.135.30',
'1.0.137.139',
'1.0.178.169',
'1.0.178.218',
'1.0.178.58',
);

by

<?php
$wgProxyList = array(
['1.0.135.30'],
['1.0.137.139'],
['1.0.178.169'],
['1.0.178.218'],
['1.0.178.58']
);

This method work i can use login page and i'm now connected, but, was very long, need a lot capacity.
The total list of ips can not be used.
The access time is far too long.

Semblait avoir été résolu mais la nouvelle méthode est très lente, et, depuis un autre wiki, le warning suivant est affiché :
Warning: IPSet: Bad mask from 'Array', ignored in /homepages/38/d548381562/htdocs/CLPublic/wiki/vendor/wikimedia/ip-set/src/IPSet.php on line 125
J'ai supprimé l'extension pour le moment.

My page in french with the same comment :
https://www.visionduweb.eu/wiki/index.php?title=Maintenance_et_securite_de_Mediawiki#Bloquer_les_robots_spammeurs_avec_wgProxyList

Event Timeline

Aklapper renamed this task from Mediawiki - 1.30 - ProxyList - White page login connexion - How block ips list with mediawiki now ? to wgProxyList in 1.30 only shows white page.Dec 14 2017, 9:58 AM
Aklapper changed the task status from Open to Stalled.

Please see Reedy's link and report back.
@Zer00CooL: For future reference, please always follow https://mediawiki.org/wiki/How_to_report_a_bug and structure your tasks by: 1) A list of steps to reproduce, step by step 2) Expected outcome 3) Actual outcome. Thanks.

Yes, this link explain all step ( in french ) :
https://www.visionduweb.eu/wiki/index.php?title=Maintenance_et_securite_de_Mediawiki#Bloquer_les_robots_spammeurs_avec_wgProxyList

I create the ips list with a script from forumstopspam.

I see documentation from mediawiki 1.30 : https://www.mediawiki.org/wiki/MediaWiki_1.30
Other changes
The use of an associative array for $wgProxyList, where the IP address is in the key instead of the value, is deprecated (e.g. [ '127.0.0.1' => 'value' ]). Please convert these arrays to indexed/sequential ones (e.g. [ '127.0.0.1' ]).

The bug :
With the old method, i have a white screen with my list :
file /extensions/bannedips.php :
Exemple
<?php
$wgProxyList = array(
'1.0.135.30',
'1.0.137.139',
'1.0.178.169',
'1.0.178.218',
'1.0.178.58',
);

If i use this file :
I can connect, very long time, and, not sur the script work good.
My second wiki say : Warning: IPSet: Bad mask from 'Array', ignored in /homepages/38/d548381562/htdocs/CLPublic/wiki/vendor/wikimedia/ip-set/src/IPSet.php on line 125
<?php
$wgProxyList = array(
['1.0.135.30'],
['1.0.137.139'],
['1.0.178.169'],
['1.0.178.218'],
['1.0.178.58']
);

So this task is about incorrect documentation, and that you https://www.mediawiki.org/wiki/Manual:$wgProxyList says "a comma-delimited list" while in reality you also need to put [ brackets ] around each item in the list?
Or something else?

If I understand correctly, it's the mediawiki 1.30 documentation that talks about ['ip']

The use of an associative array for $wgProxyList, where the IP address is in the key instead of the value, is deprecated (e.g. [ '127.0.0.1' => 'value' ]). Please convert these arrays to indexed/sequential ones (e.g. [ '127.0.0.1' ]).

  1. In my usage, I simply put in LocalSetttings.php the call to the script:

require_once("$IP/extensions/bannedips.php");

  1. Creating the file containing the ips

file /extensions/bannedips.php :
Exemple
<?php
$wgProxyList = array(
'1.0.135.30',
'1.0.137.139',
'1.0.178.169',
'1.0.178.218',
'1.0.178.58',
);

This does not work anymore since mediawiki 1.30

I never used this other script presented on the documentation : https://www.mediawiki.org/wiki/Manual:$wgProxyList

$wgHooks['userCan'][] = 'getOpenProxyList';
$gotOpenProxyList = false;
function getOpenProxyList( $article, $fields ) {
global $gotOpenProxyList, $wgProxyList;
if ( !$gotOpenProxyList ) {

		$wgProxyList = explode( ',', wfMsg( 'openproxylist' ) );

}
$gotOpenProxyList = true;
return true;
}

If I understand correctly, it's the mediawiki 1.30 documentation that talks about ['ip']

Is that wrong? Is that right? I basically want you to describe what and where the problem is, and what and where and how to fix it. Preferably in a structured comment so it's easier for others to understand - see T182841#3836807.
Also, see https://secure.phabricator.com/book/phabricator/article/remarkup/ how to format comments. Thanks :)

If I understand correctly, it's the mediawiki 1.30 documentation that talks about ['ip']

Where? I cannot see that mentioned anywhere, nor in code.

This does not work anymore since mediawiki 1.30

How do you know this doesn't work? How can you tell?

Also. You still need to enable debugging to see what that white page is. Please don't just randomly change the proxy list format and then complain things don't work

The use of an associative array for $wgProxyList, where the IP address is in the key instead of the value, is deprecated (e.g. [ '127.0.0.1' => 'value' ]). Please convert these arrays to indexed/sequential ones (e.g. [ '127.0.0.1' ]).

Your settings shouldn't need converting, you're not using an associative array

<?php
$wgProxyList = array(
'1.0.135.30',
'1.0.137.139',
'1.0.178.169',
'1.0.178.218',
'1.0.178.58',
);

It may be easier if you don't even write a php file. Just set $wgProxyList to the path to a text file/similar, and put a list of ip addresses into it. Might be simpler and less hassle for you

1.2.3.4
4.3.2.1

If I understand correctly, it's the mediawiki 1.30 documentation that talks about ['ip']

Where? I cannot see that mentioned anywhere, nor in code.

See the official documentation : https://www.mediawiki.org/wiki/MediaWiki_1.30#Other_changes
The use of an associative array for $wgProxyList, where the IP address is in the key instead of the value, is deprecated (e.g. [ '127.0.0.1' => 'value' ]). Please convert these arrays to indexed/sequential ones (e.g. [ '127.0.0.1' ]).

How do you know this doesn't work?

<?php
$wgProxyList = array(
['1.0.135.30'],
['1.0.137.139'],
['1.0.178.169'],
['1.0.178.218'],
['1.0.178.58']
);

With this list, i can use login page and i'm now connected, but, was very long, need a lot capacity.
My second wiki say : Warning: IPSet: Bad mask from 'Array', ignored in /homepages/38/d548381562/htdocs/CLPublic/wiki/vendor/wikimedia/ip-set/src/IPSet.php on line 125

If I understand correctly, it's the mediawiki 1.30 documentation that talks about ['ip']

Where? I cannot see that mentioned anywhere, nor in code.

See the official documentation : https://www.mediawiki.org/wiki/MediaWiki_1.30#Other_changes
The use of an associative array for $wgProxyList, where the IP address is in the key instead of the value, is deprecated (e.g. [ '127.0.0.1' => 'value' ]). Please convert these arrays to indexed/sequential ones (e.g. [ '127.0.0.1' ]).

You've misunderstood, it doesn't talk about ['ip'], it wants the actual IP address to be a value

Let me show you some php, with key and value representing what is actually a key and a value

$array = array(
'key' => 'value',
'key2' => 'value2'
);

$array2 = array(
'value',
'value2'
);

So, in this case, this is what is deprecated, where the IP address is the key of the array

$array = array(
'1.2.3.4' => '10',
'4.3.2.1' => '20'
);

But this is ok as the ip is the value

$array = array(
'1.2.3.4',
'4.3.2.1'
);

And, as far as PHP is concerned this is actually stored as

$array = array(
0 => '1.2.3.4',
1 => '4.3.2.1'
);

How do you know this doesn't work?

<?php
$wgProxyList = array(
['1.0.135.30'],
['1.0.137.139'],
['1.0.178.169'],
['1.0.178.218'],
['1.0.178.58']
);

With this list, i can use login page and i'm now connected, but, was very long, need a lot capacity.
My second wiki say : Warning: IPSet: Bad mask from 'Array', ignored in /homepages/38/d548381562/htdocs/CLPublic/wiki/vendor/wikimedia/ip-set/src/IPSet.php on line 125

You will probably need to give us an example file (the whole file) for this, and see if someone can replicate it for you.

But this is ok as the ip is the value

$array = array(
'1.2.3.4',
'4.3.2.1'
);

This is my old situation, and, with that, i have a white page.

I test that, only for fun, if i can found the good way.

<?php
$wgProxyList = array(
0 => '1.2.3.4',
1 => '4.3.2.1'
);

But this is ok as the ip is the value

$array = array(
'1.2.3.4',
'4.3.2.1'
);

This is my old situation, and, with that, i have a white page.

I'm guessing you have a syntax error...

If you're getting a white/blank page, there's a big error.

See https://www.mediawiki.org/wiki/Manual:How_to_debug

I test that, only for fun, if i can found the good way.

<?php
$wgProxyList = array(
0 => '1.2.3.4',
1 => '4.3.2.1'
);

That's work Good without error !
Connexion with my login OK !
Warning none ! You are a cool dev Reedy.

Now, i want test in real situation. I start the VPN on, and, i add my VPN ip.
I'm not sur ... With my VPN IP listed in banneips, i can login, and, write.
Then, bannedips not work, it's my mean. Have you more in your pocket for use it ?

Oups, in my situation, i don't have proxy serveur. ( If i need )
My mediawiki is mutualised.

Then, i'm not sur, i never use the next example from manual :

Copy and paste a comma-delimited list (eg 1.0.170.183,1.0.170.188,1.0.170.234,1.0.170.24) of open proxies into MediaWiki:Openproxylist; then put the following in LocalSettings.php :

$wgHooks [ 'userCan' ][] = 'getOpenProxyList' ;
 $gotOpenProxyList = false ;
 function getOpenProxyList ( $article , $fields ) {
 global $gotOpenProxyList , $wgProxyList ;
 if ( ! $gotOpenProxyList ) {
 $wgProxyList = explode ( ',' , wfMsg ( 'openproxylist' ) );
 }
 $gotOpenProxyList = true ;
 return true ;
 }

Closing task as invalid. Seems to be mostly about misunderstandings and typos, hence a topic for https://www.mediawiki.org/wiki/Project:Support_desk