Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Is there an isObject() test?


Reply


2 Posts   745 Views

Avatar
micahsheets

Community Member, 165 Posts

15 April 2009 at 9:09am

I often get "[Notice] Trying to get property of non-object". I would like to find an easy way to test if my variable is an object or not so I can handle the error myself in a more graceful way. Is there a function to test if something is an object?

Avatar
Willr

Forum Moderator, 5513 Posts

15 April 2009 at 9:59pm

http://php.net/is_object

Although, usually you can just make sure if its set, if its set then usually you can assume its an object if($object).....