Bug #70568 JSON_VALID treats invalid values as valid

Submitted: 9 Oct 2013 18:42 Modified: 30 Oct 2013 22:15
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: JSON User-defined function ( UDF ) Severity:S3 (Non-critical)
Version:0.2 OS:Any
Assigned to: CPU Architecture:Any

[9 Oct 2013 18:42] Sveta Smirnova
Description:
JSON_VALID treats some invalid values as valid

How to repeat:
mysql> select json_valid('{"a":false,}');
+----------------------------+
| json_valid('{"a":false,}') |
+----------------------------+
|                          1 |
+----------------------------+
1 row in set (0.00 sec)

mysql> select json_valid('{"a":"\z"}');
+--------------------------+
| json_valid('{"a":"\z"}') |
+--------------------------+
|                        1 |
+--------------------------+
1 row in set (0.00 sec)
[9 Oct 2013 18:44] Sveta Smirnova
Posted by developer:
 
\z should be interpreted as special symbol, but it is not.
[30 Oct 2013 22:14] Sveta Smirnova
Posted by developer:
 
Fixed in versions 0.2.1 and 0.3.0

select json_valid('{"a":"\z"}'); is documentation issue: "UDFs get escaped strings, therefore you need to double-escape symbol "\" to let JSON parser to deal with it. See bug70568.test and json_valid.test for usage examples." README file was also updated.
[30 Oct 2013 22:39] Sveta Smirnova
Case for select json_valid('{"a":"\\z"}'); fixed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.