Permalink
Browse files

merged branch ezzatron/yaml-negative-integers (PR #6784)

This PR was merged into the 2.0 branch.

Commits
-------

fea20b7 [Yaml] fixed #6770

Discussion
----------

[Yaml] fixed parsing of negative integers (2.0 branch)

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6770
| License       | MIT
| Doc PR        | n/a

Note that an unrelated test fixture for large integers had to be changed to work on systems with 64-bit integer support because of the change from `assertEquals()` to `assertSame()`. Please see the diff for clarification.
  • Loading branch information...
2 parents 0cbc6f6 + 60aac13 commit 92b11a78a5cce562ebd00cdc9800e87b105b2c00 @fabpot fabpot committed Jan 18, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 Inline.php
View
@@ -393,6 +393,11 @@ private static function evaluateScalar($scalar)
$cast = intval($scalar);
return '0' == $scalar[0] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
+ case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)):
+ $raw = $scalar;
+ $cast = intval($scalar);
+
+ return '0' == $scalar[1] ? octdec($scalar) : (((string) $raw == (string) $cast) ? $cast : $raw);
case 'true' === strtolower($scalar):
return true;
case 'false' === strtolower($scalar):

0 comments on commit 92b11a7

Please sign in to comment.