Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
return earlier when fixing values in the tree
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <[email protected]>
  • Loading branch information
Denys Smirnov authored and dennwc committed Oct 18, 2019
1 parent 7da5049 commit bf7d5c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion native/src/AstExtractor/Formatter/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,28 @@ private static function utf8_encode_recursive(&$input)
if (is_numeric($input)) {
if (is_nan($input)) {
$input = "NaN";
} else if (is_infinite($input)) {
return;
}
if (is_infinite($input)) {
if ($input > 0) {
$input = "+Inf";
} else {
$input = "-Inf";
}
}
return;
}
if (is_string($input)) {
$input = utf8_encode($input);
return;
}

if (is_object($input)) {
$ovs = get_object_vars($input);
foreach ($ovs as $k => $v) {
self::utf8_encode_recursive($input->$k);
}
return;
}

if (is_array($input)) {
Expand Down

0 comments on commit bf7d5c4

Please sign in to comment.