Try catch from php5 to php4?

Try catch from php5 to php4?

am 02.09.2007 18:35:46 von Enter The

how can i replace
try{
if (!$facebook->api_client->users... {
$facebook->redirect($facebook-...
} catch(Exception $e) { //this will clear cookies for your app and
redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($appcallba...
}
from php5 to php4

Re: Try catch from php5 to php4?

am 02.09.2007 18:50:55 von Bucky Kaufman

Enter The wrote:
> how can i replace
> try{
> if (!$facebook->api_client->users... {
> $facebook->redirect($facebook-...
> } catch(Exception $e) { //this will clear cookies for your app and
> redirect them to a login prompt
> $facebook->set_user(null, null);
> $facebook->redirect($appcallba...
> }
> from php5 to php4

It depends on how your interfaces for facebook->api_client works, but in
general, you should try to rephrase it as an if/then rather than a
try/catch for PHP4.

Re: Try catch from php5 to php4?

am 02.09.2007 20:17:52 von Jerry Stuckle

Enter The wrote:
> how can i replace
> try{
> if (!$facebook->api_client->users... {
> $facebook->redirect($facebook-...
> } catch(Exception $e) { //this will clear cookies for your app and
> redirect them to a login prompt
> $facebook->set_user(null, null);
> $facebook->redirect($appcallba...
> }
> from php5 to php4
>

Well, first of all, what is the type of $facebook? What is the minimum
level of PHP required for it?

You'll probably find, since it's throwing exceptions, that it requires a
minimum of PHP 5.x, and will not run under PHP 4. So you won't be able
to use it under PHP 4, either.

If this is your code, you can change the code here to check return codes
and use 'if' statements. But you'll have to change the code in the
classes also to return the proper value(s).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: Try catch from php5 to php4?

am 04.09.2007 09:51:21 von Toby A Inkster

Enter The wrote:

> how can i replace [...] from php5 to php4

You don't. You upgrade to PHP 5 before it's end-of-lifed in a few months.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 75 days, 11:30.]

TrivialEncoder/0.2
http://tobyinkster.co.uk/blog/2007/08/19/trivial-encoder/