On Mon, Dec 15, 2008 at 12:55 PM, Uwe Schindler <theta...@php.net> wrote:
> As is noted in an earlier mail, I would prefer 1 (simply document it in the
> function description). In my opinion, if somebody then passes a basic type
> to json_encode he is aware of what he is doing (hopefully).
>
> For compatibility with current code and securely escaping strings for
> javascript it is the best.

PHP 6 will require some recoding for various things.

I'd like to see it "do the right thing" in PHP 6, and perhaps if
people are using json_encode for escaping, make another function that
is there purely for escaping javascript, not serializing/unserializing
it for direct exchange with JSON consumption in javascript. After all,
this is json_encode, not javascript_escape ...

I was unaware that json_encode() [improperly] encoded
non-arrays/objects, as I expected those details to be worked out in
the implementation. While it does produce legitimate javascript it
does not produce legitimate JSON, which is the purpose of these
functions, no?

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to