Skip to content

Commit 90ddf05

Browse files
committed
Fix parameter priority bug
1 parent 0c28f72 commit 90ddf05

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Json5Decoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static function decode($source, $associative = false, $depth = 512, $opti
8888
}
8989

9090
// Fall back to JSON5 if that fails
91-
$associative = $associative || ($options & JSON_OBJECT_AS_ARRAY);
91+
$associative = $associative === true || ($associative === null && $options & JSON_OBJECT_AS_ARRAY);
9292
$castBigIntToString = $options & JSON_BIGINT_AS_STRING;
9393

9494
$decoder = new self((string)$source, $associative, $depth, $castBigIntToString);

test/Functional/OptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testAssocFalseWithNoOptionsSet()
2525
public function testAssocFalseWithAssocOption()
2626
{
2727
$result = Json5Decoder::decode('{"foo": true}', false, 512, JSON_OBJECT_AS_ARRAY);
28-
$this->assertInternalType('array', $result);
28+
$this->assertInstanceOf('\stdClass', $result);
2929
}
3030

3131
public function testBigIntWithNoOptionsSet()

0 commit comments

Comments
 (0)