NYCPHP Meetup

NYPHP.org

[nycphp-talk] 2 more php5 questions ...

jon baer jonbaer at jonbaer.net
Mon Feb 16 16:33:20 EST 2004


> For instance, what should PHP do if you pass in a "string" that can be
> coerced into an integer? This'll happen if your data comes from a form
> or a database.

I personally think this should all happen *before* it hits a signatured
method ... like I said even if there is no checking its nice for commenting,
something like function foo($bar) vs. function foo(String $bar) does not
have to throw a fatal error like a custom class does nor does it have to
cast acordingly - I guess everyone just takes it as a shortcut or names
their variables in a nice way :-)

> It's tough to create a balance where people who are really into OO can
> go object-wild while "regular programmers" can just program and not
> worry about all the extra baggage they don't care about.

To be honest the current error handling per PHP is fine, I think its mainly
in what third-party apps comes up with that should be handled neatly in a
standard way, I think its good because it at least *shows* that bad stuff
can happen w/ a method vs. never really checking for it to begin w/ and
helps with security.  Even if there is no real "sandbox" w/ PHP at least
having a trap be *mandatory* helps create better code I think.

Thanks for taking the time to answer the Q's.

- Jon




More information about the talk mailing list