summaryrefslogtreecommitdiff
path: root/ext/json/tests/unsupported_type_error.phpt
blob: 2564c6a3c8c614c435ff0410491a28925f3bfc81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--TEST--
An error is thrown when an unsupported type is encoded
--FILE--
<?php

$resource = fopen(__FILE__, "r");

var_dump($resource);

var_dump(json_encode($resource));
var_dump(json_last_error());

var_dump(json_encode($resource, JSON_PARTIAL_OUTPUT_ON_ERROR));
var_dump(json_last_error());

?>
--EXPECTF--
resource(5) of type (stream)

Warning: json_encode(): type is unsupported in %s on line %d
bool(false)
int(8)

Warning: json_encode(): type is unsupported in %s on line %d
string(4) "null"
int(8)