PocketMine/PocketMine-MP — pull request #944 by lloydw (2013-11-24 03:29:54+00:00)
Title: Fix argument parsing

This fixes a bug with parsing arguments with only 1 character:

Test code:
$args = '--data-path /home/pocketserver/worlds/sphaxzmcpeserver --server-port 43722 --max-players 8 --enable-ansi false --memory-limit 128M';
preg_match_all('/ (--[\w\-]+ (?:[= ] [^-\s]+ )? ) | (-\w+) | (\w+) /x', $args, $match );
$args = array_shift( $match );
print_r($args);

Old code:
Array
(
[0] => --data-path /home/pocketserver/worlds/sphaxzmcpeserver
[1] => --server-port 43722
[2] => --max-players
[3] => 8
[4] => --enable-ansi false
[5] => --memory-limit 128M
)

New Code:
Array
(
[0] => --data-path /home/pocketserver/worlds/sphaxzmcpeserver
[1] => --server-port 43722
[2] => --max-players 8
[3] => --enable-ansi false
[4] => --memory-limit 128M
)