I was tracking down an issue that now appears to be separate in importImages (https://gerrit.wikimedia.org/r/#/c/268314/) while I stumbled into this weirdness through mcc.php. Wikimedia servers have been affected since https://gerrit.wikimedia.org/r/#/c/267816/
Description
Description
Details
Details
Related Changes in Gerrit:
| Subject | Author | Repo | Branch | Lines +/- | |
|---|---|---|---|---|---|
| Try to fix some other broken-looking legacy maintenance script options | Alex Monk | mediawiki/core | master | +15 -3 |
Related Objects
Related Objects
Event Timeline
Comment Actions
Docs for getopt say:
The parsing of options will end at the first non-option found, anything that follows is discarded.
So looks like PHP thinks testP2557.php is the first option. MWScript.php messes with $argv but I don't think PHP takes the data from this variable. From the code it looks like it uses $_SERVER['argv']. Also, looks like directly modifying it won't help much - it still uses the original value.
Comment Actions
krenair@terbium:~$ cat /srv/mediawiki/php-1.27.0-wmf.12/maintenance/testT125748.php
<?php
$options = getopt( '', array( 'help' ) );
var_dump( $options, $argv, $_SERVER["argv"] );
krenair@terbium:~$ sudo -u www-data php "/srv/mediawiki/multiversion/MWScript.php" testT125748.php commonswiki --help
array(1) {
["help"]=>
bool(false)
}
array(3) {
[0]=>
string(15) "testT125748.php"
[1]=>
string(18) "--wiki=commonswiki"
[2]=>
string(6) "--help"
}
array(4) {
[0]=>
string(40) "/srv/mediawiki/multiversion/MWScript.php"
[1]=>
string(15) "testT125748.php"
[2]=>
string(11) "commonswiki"
[3]=>
string(6) "--help"
}
krenair@terbium:~$ sudo -u www-data php5 "/srv/mediawiki/multiversion/MWScript.php" testT125748.php commonswiki --help
array(0) {
}
array(3) {
[0]=>
string(15) "testT125748.php"
[1]=>
string(18) "--wiki=commonswiki"
[2]=>
string(6) "--help"
}
array(4) {
[0]=>
string(40) "/srv/mediawiki/multiversion/MWScript.php"
[1]=>
string(15) "testT125748.php"
[2]=>
string(11) "commonswiki"
[3]=>
string(6) "--help"
}Comment Actions
Change 268328 had a related patch set uploaded (by Alex Monk):
Try to fix some other broken-looking legacy maintenance script options
Comment Actions
Change 268328 merged by jenkins-bot:
Try to fix some other broken-looking legacy maintenance script options
Comment Actions
This was fixed by @Krenair by just not using getopt() anymore, which seems good enough to me. I confirmed that we're not using it, except in tests.