Skip to content

Commit

Permalink
Fix TRAC-1016.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 8, 2010
1 parent eca3212 commit e8411e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
18 changes: 9 additions & 9 deletions PHPUnit/Util/Getopt.php
Expand Up @@ -76,7 +76,7 @@ public static function getopt(array $args, $short_options, $long_options = NULL)
sort($long_options);
}

if (isset($args[0]{0}) && $args[0]{0} != '-') {
if (isset($args[0][0]) && $args[0][0] != '-') {
array_shift($args);
}

Expand All @@ -93,13 +93,13 @@ public static function getopt(array $args, $short_options, $long_options = NULL)
break;
}

if ($arg{0} != '-' ||
(strlen($arg) > 1 && $arg{1} == '-' && !$long_options)) {
if ($arg[0] != '-' ||
(strlen($arg) > 1 && $arg[1] == '-' && !$long_options)) {
$non_opts = array_merge($non_opts, array_slice($args, $i));
break;
}

elseif (strlen($arg) > 1 && $arg{1} == '-') {
elseif (strlen($arg) > 1 && $arg[1] == '-') {
self::parseLongOption(
substr($arg, 2), $long_options, $opts, $args
);
Expand All @@ -120,18 +120,18 @@ protected static function parseShortOption($arg, $short_options, &$opts, &$args)
$argLen = strlen($arg);

for ($i = 0; $i < $argLen; $i++) {
$opt = $arg{$i};
$opt = $arg[$i];
$opt_arg = NULL;

if (($spec = strstr($short_options, $opt)) === FALSE ||
$arg{$i} == ':') {
$arg[$i] == ':') {
throw new PHPUnit_Framework_Exception(
"unrecognized option -- $opt"
);
}

if (strlen($spec) > 1 && $spec{1} == ':') {
if (strlen($spec) > 2 && $spec{2} == ':') {
if (strlen($spec) > 1 && $spec[1] == ':') {
if (strlen($spec) > 2 && $spec[2] == ':') {
if ($i + 1 < $argLen) {
$opts[] = array($opt, substr($arg, $i + 1));
break;
Expand Down Expand Up @@ -180,7 +180,7 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args)

$opt_rest = substr($long_opt, $opt_len);

if ($opt_rest != '' && $opt{0} != '=' && $i + 1 < $count &&
if ($opt_rest != '' && $opt[0] != '=' && $i + 1 < $count &&
$opt == substr($long_options[$i+1], 0, $opt_len)) {
throw new PHPUnit_Framework_Exception(
"option --$opt is ambiguous"
Expand Down
4 changes: 2 additions & 2 deletions PHPUnit/Util/Test.php
Expand Up @@ -300,7 +300,7 @@ private static function resolveCoversToReflectionObjects($coveredElement)
if (strpos($coveredElement, '::') !== FALSE) {
list($className, $methodName) = explode('::', $coveredElement);

if ($methodName{0} == '<') {
if ($methodName[0] == '<') {
$classes = array($className);

foreach ($classes as $className)
Expand All @@ -318,7 +318,7 @@ private static function resolveCoversToReflectionObjects($coveredElement)

$class = new ReflectionClass($className);
$methods = $class->getMethods();
$inverse = isset($methodName{1}) && $methodName{1} == '!';
$inverse = isset($methodName[1]) && $methodName[1] == '!';

if (strpos($methodName, 'protected')) {
$visibility = 'isProtected';
Expand Down
5 changes: 5 additions & 0 deletions README.markdown
Expand Up @@ -3,6 +3,11 @@ PHPUnit 3.4

This is the list of changes for the PHPUnit 3.4 release series.

PHPUnit 3.4.12
--------------

* Fixed TRAC-1016: Usage of `{}` to access string offsets is deprecated.

PHPUnit 3.4.11
--------------

Expand Down

0 comments on commit e8411e5

Please sign in to comment.