Page MenuHomePhabricator
Paste P2558

PHP script argument parsing wtf - HHVM 3.6.5 vs. PHP 5.5.9
ActivePublic

Authored by Krenair on Feb 3 2016, 9:45 PM.
krenair@terbium:~$ sudo -u www-data php "/srv/mediawiki/multiversion/MWScript.php" testP2557.php commonswiki --help
array(1) {
["help"]=>
bool(false)
}
array(3) {
[0]=>
string(13) "testP2557.php"
[1]=>
string(18) "--wiki=commonswiki"
[2]=>
string(6) "--help"
}
krenair@terbium:~$ sudo -u www-data php5 "/srv/mediawiki/multiversion/MWScript.php" testP2557.php commonswiki --help
array(0) {
}
array(3) {
[0]=>
string(13) "testP2557.php"
[1]=>
string(18) "--wiki=commonswiki"
[2]=>
string(6) "--help"
}
krenair@terbium:~$ php5 --version
PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
krenair@terbium:~$ php --version
HipHop VM 3.6.5 (rel)
Compiler: 1443697402_580739891
Repo schema: 10f852e58e0252284afc3158c4951c7db69aecd2
Extension API: 20150212
krenair@terbium:~$ cat /srv/mediawiki/php-1.27.0-wmf.10/maintenance/testP2557.php
<?php
//require_once __DIR__ . '/commandLine.inc';
$options = getopt( '', array( 'debug', 'help', 'cache:' ) );
var_dump( $options, $argv );