Motig Posted November 30, 2009 Share Posted November 30, 2009 I now get this error: Wrong parameters for Exception([string $exception [, long $code ]]) Here is the extending class: class ml_Exception extends Exception { public function __construct($message = null, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); } public function __toString() { return "[" . $this->code . "]: <span class=\"error\">" . $this->message . "</span>"; } } And the exception is thrown in this line: throw new ml_Exception("User with ID " . $f_id . " does not exist.", 1); Again, help appreciated, thanks Link to comment https://forums.phpfreaks.com/topic/183447-extending-exception/ Share on other sites More sharing options...
rajivgonsalves Posted November 30, 2009 Share Posted November 30, 2009 the Exception class __construct takes only two parameter your giving 3 Link to comment https://forums.phpfreaks.com/topic/183447-extending-exception/#findComment-968317 Share on other sites More sharing options...
Motig Posted November 30, 2009 Author Share Posted November 30, 2009 Thank you, that appears to have solved it. Though I simply copied the majority of the example class on the official PHP page: http://www.php.net/manual/en/language.exceptions.extending.php So it seems odd that that happens. Or am I missing something? Link to comment https://forums.phpfreaks.com/topic/183447-extending-exception/#findComment-968319 Share on other sites More sharing options...
Mchl Posted November 30, 2009 Share Posted November 30, 2009 Exception $previous = null parameter has been added in 5.3 AFAIR Link to comment https://forums.phpfreaks.com/topic/183447-extending-exception/#findComment-968332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.