Jump to content

Odd error what tells object isn't object :S


sircatsquid

Recommended Posts

Is it possible that php says the error is in the wrong line.It's now saying that my object isn't an object. But if I var_dump, It says it's an object.

Fatal error: Call to a member function getID() on a non-object in /var/www/lib/UserTypeHandle.php on line 84
$lang = ($type->getLanguage()) ? $type->getLanguage() : self::$ref->URL()->getLang();$langID = $lang->getID(); //Line: 84, this becomes an error untill I do exit on the next line then everything is OK.

This is the var_dump of $lang:

object(Language)#22 (5) { ["name":"Language":private]=> string(2) "en" ["lastUpdated":"Language":private]=> string(19) "0000-00-00 00:00:00" ["createDate":"Language":private]=> string(19) "2013-04-10 16:30:28" ["id":"Language":private]=> int(1) ["dataHandleFlag":"DataHolder":private]=> int(1) }

Very confused.

Link to comment
Share on other sites

That looks fine to me.
I did find the problem but oddly I got the error at that place, cause the error was couple of hundred lines away :/ Had to use exit to find the location of the error, moving one line at the time till the error occurred again. But it's odd that the compiler can't tell where it was :S
Link to comment
Share on other sites

It will only report the line where it detected an error. Maybe the cause is somewhere else, but it reports the point at which it determined that there is a problem.
Yeah I know, this just felt so far of. Should really make a automated testing script on all methods. Instead of manually test everything. I should really learn how to use a TDD library.
Link to comment
Share on other sites

look into phpunit
Oh, PEAR I know where is other ways on the page to get it to but, I don't really get PEAR cause I never get it to install successfully or work. :( is that something normal with PEAR?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...