One thing to consider is changing json_encode to add a header Content-type: application/json (or x-javascript), unless the additional arguments are used.. That way someone using the function to intermingle with HTML will be faced with the fact they have to encode the output, otherwise it breaks the page...

ob_iconv_handler() does something similar to this and I consider it a mistake as:

ob_start('ob_iconv_handler');
echo "Foo";
ob_flush();
echo "Bar";

Will result in a headers already sent message, even though no explicit attempt is made to send headers.

I've been meaning to come up with a BC fix for this... In time for 5.3 at least...

-Sara

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

Reply via email to