PC Nerd Posted December 20, 2008 Share Posted December 20, 2008 Hi, I've had a look around and im looking for the source code for the Exception class. I've seen form a number of sources the class design ( ie, a list of member variables and methods) - but I wanted to look at the actual source for the class. Can anyone suggest where this might be? Thanks Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted December 20, 2008 Author Share Posted December 20, 2008 bump Quote Link to comment Share on other sites More sharing options...
lanmonkey Posted December 20, 2008 Share Posted December 20, 2008 you could probably do this using reflection http://uk.php.net/oop5.reflection Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted December 20, 2008 Author Share Posted December 20, 2008 Ok, Ive run it through Reflection - and it seems that all I get is an output of the classes properties and methods - not the actual source code that was used to create the class. Is the Exception class written in PHP or is it "built" in the C/C++ in compilation? Thanks Ive placed what I get below: <?php echo "<pre>"; Reflection::export(new ReflectionClass('Exception')); echo "</pre>"; ?> DISPLAYS: Class [ class Exception ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [6] { Property [ protected $message ] Property [ private $string ] Property [ protected $code ] Property [ protected $file ] Property [ protected $line ] Property [ private $trace ] } - Methods [9] { Method [ final private method __clone ] { } Method [ method __construct ] { - Parameters [2] { Parameter #0 [ $message ] Parameter #1 [ $code ] } } Method [ final public method getMessage ] { } Method [ final public method getCode ] { } Method [ final public method getFile ] { } Method [ final public method getLine ] { } Method [ final public method getTrace ] { } Method [ final public method getTraceAsString ] { } Method [ public method __toString ] { } } } Quote Link to comment Share on other sites More sharing options...
trq Posted December 20, 2008 Share Posted December 20, 2008 You'll need to download php's source. The built in Exception class is part of php core, written in C. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted December 20, 2008 Author Share Posted December 20, 2008 EDIT: And jsut at the moment i post it I find the file, I think: Is it zend_exceptions.c ? Thanks ( Ive removed my original post stating I couldnt find the file in the source) Thanks Quote Link to comment Share on other sites More sharing options...
trq Posted December 20, 2008 Share Posted December 20, 2008 Do you know what file/section of the source its in. Looks like its in Zend/zend_exceptions.{c,h} Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted December 20, 2008 Author Share Posted December 20, 2008 Fantastic thanks ( now for interpretting the C code ) Solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.