Skip to content

Commit

Permalink
replace json.erl with json2.erl to fix issue 50
Browse files Browse the repository at this point in the history
Yaws issue 50 (erlyaws#50) notes that
the json.erl module uses list_to_atom and is therefore dangerous due
to the possibility of filling the atom table. Also, the test function
in json.erl has been broken for quite some time. Deprecate json.erl
and add json2.erl, which avoids list_to_atom. Repair the json2:test/0
function inherited from json.erl and add it to the t1 test
suite. Change www/json_intro.yaws to refer to json2.
vinoski committed Apr 24, 2011
1 parent 5d8fd4a commit 96534b2
Showing 8 changed files with 743 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ MODULES=yaws \
yaws_rss \
yaws_dav \
yaws_pam \
json jsonrpc yaws_jsonrpc yaws_xmlrpc\
json json2 jsonrpc yaws_jsonrpc yaws_xmlrpc\
haxe yaws_rpc \
yaws_soap_srv yaws_soap_lib \
authmod_gssapi \
20 changes: 20 additions & 0 deletions src/json.erl
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
%%%
%%% Use module json2.erl instead
%%%
%%% This module is deprecated. It uses list_to_atom and so could potentially
%%% fill the atom table. It also fails to pass its own internal tests due to
%%% changes made years ago outside the context of Yaws.
%%%
%%% Do not report problems with this module, as they will not be fixed. You
%%% should instead convert your code to use the json2 module.
%%%
%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
%%% WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED WARNING DEPRECATED
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%(%% Copyright (c) 2005-2006, A2Z Development USA, Inc. All Rights Reserved.
%%%
%%% The contents of this file are subject to the Erlang Public License,
@@ -15,6 +34,7 @@
%%% All Rights Reserved.

-module(json).
-deprecated(module).
-export([encode/1, decode_string/1, decode/2]).
-export([is_obj/1, obj_new/0, obj_fetch/2, obj_find/2, obj_is_key/2]).
-export([obj_store/3, obj_from_list/1, obj_fold/3]).
Loading
Oops, something went wrong.

0 comments on commit 96534b2

Please sign in to comment.