json_last_error

json_last_error

am 04.12.2009 19:23:08 von Kirby Bakken

None of the servers I run on have PHP 5.3, and I have no idea when
they'll be updated. The json_last_error function is in 5.3. What can I
do to provide a temporary json_last_error function until my servers get
updated to 5.3? Is there source available for json_last_error somewhere?

Thanks,

Kirby

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: json_last_error

am 04.12.2009 20:16:18 von List Manager

Kirby Bakken wrote:
> None of the servers I run on have PHP 5.3, and I have no idea when
> they'll be updated. The json_last_error function is in 5.3. What can I
> do to provide a temporary json_last_error function until my servers get
> updated to 5.3? Is there source available for json_last_error somewhere?
>
> Thanks,
>
> Kirby
>

I don't believe you will be able to provide this functionality without
recreating the json_decode() function also.

json_last_error() looks like it retrieves information that is from the last
attempt to run json_decode() on a given string. My guess is that json_decode()
set an internal variable that json_last_error() picks up and returns.

Without having json_decode() say what the problem was/is then you can never
recreate the json_last_error() function.

Jim Lucas

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: json_last_error

am 04.12.2009 20:26:40 von Ryan Sun

--001636d3448d55ddee0479ec1612
Content-Type: text/plain; charset=ISO-8859-1

json_decode
(PHP 5 >= 5.2.0, PECL json >= 1.2.0)

so json_decode will be avaliable for php 5.2.0+

php is open source, I believe you can get an idea from their C source

On Fri, Dec 4, 2009 at 2:16 PM, Jim Lucas wrote:

> Kirby Bakken wrote:
> > None of the servers I run on have PHP 5.3, and I have no idea when
> > they'll be updated. The json_last_error function is in 5.3. What can I
> > do to provide a temporary json_last_error function until my servers get
> > updated to 5.3? Is there source available for json_last_error somewhere?
> >
> > Thanks,
> >
> > Kirby
> >
>
> I don't believe you will be able to provide this functionality without
> recreating the json_decode() function also.
>
> json_last_error() looks like it retrieves information that is from the last
> attempt to run json_decode() on a given string. My guess is that
> json_decode()
> set an internal variable that json_last_error() picks up and returns.
>
> Without having json_decode() say what the problem was/is then you can never
> recreate the json_last_error() function.
>
> Jim Lucas
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--001636d3448d55ddee0479ec1612--