Skip to content

Commit

Permalink
Merge pull request #4 from Skyscanner/length_re_wrong
Browse files Browse the repository at this point in the history
Bug fix in `.length` regex. Minor code cleanup.
  • Loading branch information
Alessio Linares committed Dec 2, 2016
2 parents 14c8fb0 + 6054cb1 commit dbb9140
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Changelog
=========
0.7.3
-----
* Bug fix in `.length` regex.
* Minor code cleanup.

0.7.2
-----
* Documentation now properly defines what a variable name is.
* Dependencies are now properly defined for older PHP versions.

0.7.1
-----
* Bug fix when accessing an array with a negative index. It now behaves as expected.
Expand Down
6 changes: 2 additions & 4 deletions src/Skyscanner/JsonPath/JsonObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class JsonObject
// Array expressions
const RE_ARRAY_INTERVAL = '/^(?:(-?\d*:-?\d*)|(-?\d*:-?\d*:-?\d*))$/';
const RE_INDEX_LIST = '/^(-?\d+)(\s*,\s*-?\d+)*$/';
const RE_LENGTH = '/^(.*).length$/';
const RE_LENGTH = '/^(.*)\.length$/';

// Object expression
const RE_CHILD_NAME_LIST = '/^(:?([a-zA-Z\_\$][\w\$]*?|".*?"|\'.*?\')(\s*,\s*([a-zA-Z\_\$][\w\$]*|".*?"|\'.*?\'))*)$/';
Expand Down Expand Up @@ -477,8 +477,7 @@ private function booleanExpressionAnds(&$jsonObject, $expression)
if ($result !== false) {
return false;
}
}
else {
} else {
if ($result === false) {
return false;
}
Expand Down Expand Up @@ -663,7 +662,6 @@ function($x) use ($createInexistent, $jsonObject) {

private function opRecursiveSelector(&$jsonObject, $childName, &$result)
{
//$result[] = &$jsonObject;
$this->opChildName($jsonObject, $childName, $result);
if (is_array($jsonObject)) {
foreach ($jsonObject as &$item) {
Expand Down

0 comments on commit dbb9140

Please sign in to comment.