PHP Notices

1 view
Skip to first unread message

Scott Bressler

unread,
Oct 25, 2010, 9:46:40 PM10/25/10
to edit...@googlegroups.com
Is there a better way to fix them? A WP helper function? Adding $new_var = isset($var) ? $var : ''; all over the place seems annoying.

Daniel Bachhuber

unread,
Oct 25, 2010, 10:05:36 PM10/25/10
to edit...@googlegroups.com
How would the helper function work?

On 25 Oct 2010, at 9:46 PM, Scott Bressler wrote:

> Is there a better way to fix them? A WP helper function? Adding $new_var = isset($var) ? $var : ''; all over the place seems annoying.

--
http://db.ly/info

Scott Bressler

unread,
Oct 25, 2010, 10:15:56 PM10/25/10
to edit...@googlegroups.com
I mean we certainly could write one that just does exactly that ternary operation. Perhaps you also pass in a default value rather than just always setting it to an empty string. But just curious if WP has something like that or if they also use isset all over the place when getting stuff out of $_GET and $_POST.

Daniel Bachhuber

unread,
Oct 26, 2010, 9:42:32 AM10/26/10
to edit...@googlegroups.com
Core seems to use a lot of isset() and !empty(). It also appears their logic is set so that no other code executes unless the conditions are met (e.g. they don't have to set the variable to a null value
Reply all
Reply to author
Forward
0 new messages