On Wed, Jun 27, 2012 at 1:27 PM, Benjamin Eberlei <kont...@beberlei.de> wrote:
>
> On Wed, Jun 27, 2012 at 1:41 AM, Stas Malyshev <smalys...@sugarcrm.com>
> wrote:
>>
>> Hi!
>>
>> > Makes sense to me. So should I do this? Remove warnings + add string
>> > parameter for json_last_error?
>
>
> I think its weird that the parameter is called $error_string and setting it
> to true means returning an array.
>
> Why not in the spirit of others have a new function json_last_error_msg() or
> something similar?

I implemented it with json_last_error(true) returning just a string,
not an array. You can get the array using array(json_last_error(),
json_last_error(true)) if you really want. But usually you will only
need one of them as they both have different use cases. The
stringified version for debugging and the error code version for
detecting the error programmatically.

Nikita

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

Reply via email to