Unable to call getMessage method on an exception object.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
witheredOldMale
Forum Newbie
Posts: 5
Joined: Wed Apr 22, 2009 1:49 pm

Unable to call getMessage method on an exception object.

Post by witheredOldMale »

After calling a method that throws an exception, I do
zval *ex = EG(exception);
if(ex != NULL)
{
zend_class_entry *exce = Z_OBJCE_P(ex);
zval *zmsg = zend_call_method(&ex,exce,NULL,"getMessage",11,&zCtorRet,0,NULL,NULL);
char *msg = Z_STRVAL_P(zmsg);
}

It fails with
<b>Fatal error</b>: Couldn't find implementation for method Exception::getMessage

What’s wrong here?
Thanks
OldMale.
Post Reply