[PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Ilia Alshanetsky
On 12-Dec-08, at 10:50 PM, Scott MacVicar wrote: Hi All, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly identified #38680 as not a bug but it appears that Ilia added support for this

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Lukas Kahwe Smith
On 13.12.2008, at 18:59, Ilia Alshanetsky wrote: On 12-Dec-08, at 10:50 PM, Scott MacVicar wrote: Hi All, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly identified #38680 as not a bug

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Christian Seiler
Hi, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly identified #38680 as not a bug but it appears that Ilia added support for this anyway violating the RFC [1]. Maybe there was a reason for

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Ilia Alshanetsky
Lukas, Reading the spec it clearly says in the pre-amble that JSON can represent both primitive and complex data types From RFC: JSON can represent four primitive types (strings, numbers, booleans, and null) and two structured types (objects and arrays). The RFC also says that when it

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Rasmus Lerdorf
Lukas Kahwe Smith wrote: On 13.12.2008, at 18:59, Ilia Alshanetsky wrote: On 12-Dec-08, at 10:50 PM, Scott MacVicar wrote: Hi All, Basic types were added to our JSON decoder to PHP 5.2.1, this allows one to use json_encode / json_decode on any of our scalar types. Omar correctly

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Scott MacVicar
The JSON grammar explicitly says that it's not supported. 2. JSON Grammar A JSON text is a sequence of tokens. The set of tokens includes six structural characters, strings, numbers, and three literal names. A JSON text is a serialized object or array. JSON-text = object / array ---

Re: [PHP-DEV] Re: Removing basic types from our JSON parser

2008-12-13 Thread Ilia Alshanetsky
Please re-read my comments again. First of all RFC says that basic types are support even identifies them by name, secondly it says you MAY extend the syntax. What other languages do is fine and up to them to implement, unless you want to make a case for making PHP a copy of [language of

RE: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread Uwe Schindler
For reference I saw people use json_encode() to pass a string to javascript into their page while avoiding bugs/XSS with stuff like /script. var foo = ?=json_encode($my_string)?; ... (yes, they maybe heared somewhere that JSON is *not* javascript, I told 'em too). This is not correct.

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread Stan Vassilev | FM
var foo = ?=json_encode($my_string)?; ... (yes, they maybe heared somewhere that JSON is *not* javascript, I told 'em too). JSON is a strict subset of JavaScript, and the above scenario is something I also do often. Since PHP generates web pages, any time I need to generate a JS literal

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread Rasmus Lerdorf
Stan Vassilev | FM wrote: var foo = ?=json_encode($my_string)?; ... (yes, they maybe heared somewhere that JSON is *not* javascript, I told 'em too). JSON is a strict subset of JavaScript, and the above scenario is something I also do often. Since PHP generates web pages, any time I need

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread moo . tinys
I'm not sure if that is the right way of looking at it though. I think the only question is how to represent the scalar types, not whether they should be allowed. As far as I am concerned it is obvious that they be allowed and the JSON spec is quite explicit that JSON can be used to

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread mike
Sorry for top posting. I see no reason why php should not interop with javascript 100% as it should. I do not see a reason to create new functions, parameters, etc. The existing should be expected to both encode and decode json with javascript properly. If there is a mismatch right now,

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread Rasmus Lerdorf
mike wrote: Sorry for top posting. I see no reason why php should not interop with javascript 100% as it should. I do not see a reason to create new functions, parameters, etc. The existing should be expected to both encode and decode json with javascript properly. If there is a mismatch

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread mike
I can't give specifics (I'm mobile and I don't remember where the code would be anyway) but we had an issue with php and javascript exchange via json where the php output using json_encode and we had to wrap it with additional braces for it to be usable. Sorry for being vague, this thread

Re: [PHP-DEV] Removing basic types from our JSON parser

2008-12-13 Thread Rasmus Lerdorf
Yes, but that would be going to a json_parse thing somewhere, not pure Javascript. -Rasmus mike wrote: I can't give specifics (I'm mobile and I don't remember where the code would be anyway) but we had an issue with php and javascript exchange via json where the php output using json_encode