Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 36fa17a5fa
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 29 lines (22 sloc) 0.767 kb
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 27 28
--TEST--
Bug #43941 (json_encode() invalid UTF-8)
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php

var_dump(json_encode("abc"));
var_dump(json_encode("ab\xE0"));
var_dump(json_encode("ab\xE0", JSON_PARTIAL_OUTPUT_ON_ERROR));
var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc"), JSON_PARTIAL_OUTPUT_ON_ERROR));

echo "Done\n";
?>
--EXPECTF--
string(5) ""abc""

Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
bool(false)

Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
string(4) "null"

Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d

Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
string(17) "[null,null,"abc"]"
Done
Something went wrong with that request. Please try again.