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

2008-12-14 Thread Rasmus Lerdorf
mike wrote: On Sun, Dec 14, 2008 at 12:39 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: Eh? Read what you wrote there. If json wasn't pure javascript, how in the world would eval() work on it? Sorry. I guess I meant it didn't execute by itself, but needed to be interpreted using

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

2008-12-14 Thread Uwe Schindler
script var foo = ?php echo json_encode($foo)?; /script will always work. The only question is what sort of variable foo will end up being. The RFC says we have to wrap basic types in an array or object, while currently we let the basic types through without the wrapper. He problem her

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

2008-12-14 Thread David Grudl
Původní zpráva Předmět: [PHP-DEV] Removing basic types from our JSON parser Od: theta...@php.net (Uwe Schindler) Komu: Datum: 14.12.2008 10:40 script var foo = ?php echo json_encode($foo)?; /script will always work. The only question is what sort of variable foo will end up

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

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

2008-12-12 Thread Scott MacVicar
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 anyway violating the RFC [1]. Maybe there was a

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

2008-12-12 Thread mike
Fri, Dec 12, 2008 at 7:50 PM, Scott MacVicar sc...@macvicar.net wrote: The problem here is that none of the other JSON parsers in any other language support this and more importantly the browsers [2] which are now adding native JSON support. Users are frequently expecting the result from a

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

2008-12-12 Thread Mark Karpeles
Le samedi 13 décembre 2008 à 03:50 +, Scott MacVicar a écrit : 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

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

2008-12-12 Thread Rasmus Lerdorf
Mark Karpeles wrote: Le samedi 13 décembre 2008 à 03:50 +, Scott MacVicar a écrit : 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