Skip to content

Commit bcc87ba

Browse files
committed
Revert change 3f3ad30: There shouldn't be new features in 5.3, especially
not if they aren't in 5.4, too.
1 parent d80ff39 commit bcc87ba

File tree

5 files changed

+25
-45
lines changed

5 files changed

+25
-45
lines changed

ext/json/json.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ static PHP_MINIT_FUNCTION(json)
7373
REGISTER_LONG_CONSTANT("JSON_HEX_QUOT", PHP_JSON_HEX_QUOT, CONST_CS | CONST_PERSISTENT);
7474
REGISTER_LONG_CONSTANT("JSON_FORCE_OBJECT", PHP_JSON_FORCE_OBJECT, CONST_CS | CONST_PERSISTENT);
7575
REGISTER_LONG_CONSTANT("JSON_NUMERIC_CHECK", PHP_JSON_NUMERIC_CHECK, CONST_CS | CONST_PERSISTENT);
76-
REGISTER_LONG_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR, CONST_CS | CONST_PERSISTENT);
7776

7877
REGISTER_LONG_CONSTANT("JSON_ERROR_NONE", PHP_JSON_ERROR_NONE, CONST_CS | CONST_PERSISTENT);
7978
REGISTER_LONG_CONSTANT("JSON_ERROR_DEPTH", PHP_JSON_ERROR_DEPTH, CONST_CS | CONST_PERSISTENT);
@@ -321,7 +320,9 @@ static void json_escape_string(smart_str *buf, char *s, int len, int options TSR
321320
}
322321
if (len < 0) {
323322
JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
324-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument");
323+
if (!PG(display_errors)) {
324+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UTF-8 sequence in argument");
325+
}
325326
smart_str_appendl(buf, "null", 4);
326327
} else {
327328
smart_str_appendl(buf, "\"\"", 2);
@@ -570,11 +571,7 @@ static PHP_FUNCTION(json_encode)
570571

571572
php_json_encode(&buf, parameter, options TSRMLS_CC);
572573

573-
if (JSON_G(error_code) != PHP_JSON_ERROR_NONE && options ^ PHP_JSON_PARTIAL_OUTPUT_ON_ERROR) {
574-
ZVAL_FALSE(return_value);
575-
} else {
576-
ZVAL_STRINGL(return_value, buf.c, buf.len, 1);
577-
}
574+
ZVAL_STRINGL(return_value, buf.c, buf.len, 1);
578575

579576
smart_str_free(&buf);
580577
}

ext/json/php_json.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ PHP_JSON_API void php_json_decode(zval *return_value, char *str, int str_len, ze
5656
#define PHP_JSON_HEX_QUOT (1<<3)
5757
#define PHP_JSON_FORCE_OBJECT (1<<4)
5858
#define PHP_JSON_NUMERIC_CHECK (1<<5)
59-
#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9)
6059

6160
#define PHP_JSON_OUTPUT_ARRAY 0
6261
#define PHP_JSON_OUTPUT_OBJECT 1

ext/json/tests/bug43941.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #43941 (json_encode() invalid UTF-8)
3+
--SKIPIF--
4+
<?php if (!extension_loaded("json")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
8+
var_dump(json_encode("abc"));
9+
var_dump(json_encode("ab\xE0"));
10+
var_dump(json_encode("ab\xE0c"));
11+
var_dump(json_encode(array("ab\xE0", "ab\xE0c", "abc")));
12+
13+
echo "Done\n";
14+
?>
15+
--EXPECTF--
16+
string(5) ""abc""
17+
string(4) "null"
18+
string(4) "null"
19+
string(17) "[null,null,"abc"]"
20+
Done
21+

ext/json/tests/bug54058.phpt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@ json_encode($c);
2929
var_dump(json_last_error());
3030
?>
3131
--EXPECTF--
32-
Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
3332
int(5)
34-
35-
Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
3633
int(5)
37-
38-
Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
3934
int(5)
40-
41-
Warning: json_encode(): Invalid UTF-8 sequence in argument in %s on line %d
4235
int(5)

ext/json/tests/bug61537.phpt

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)