Re: [PHP] json_last_error

2009-12-04 Thread Ryan Sun
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
>
>


Re: [PHP] json_last_error

2009-12-04 Thread Jim Lucas
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