|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-22 21:57 UTC] derick@php.net
[2006-02-22 23:04 UTC] tech at vosys dot com dot br
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu May 07 19:00:02 2026 UTC |
Description: ------------ I used the constructor method name like __constructor for an Exception class. When I tried get a attribute value from a catch{} block this is not returned. When I set the constructor method name like the class name works well. Reproduce code: --------------- class Except extends Exception{// SIMPLE CLASS FOR ERROR MANAGEMENT private $e = ''; public function __construcor($msg){ $this->e = $msg; } public function getErrorMessage(){ return $this->e; } } class Test{// CLASS FOR SIMPLE TEST public function Test($info){ try{ if ($info != 'ok'){ throw new Except('Error Simulation'); }else{ throw new Except('Positive Simulation'); } }catch(Exception $e){ throw $e; } } } try{// ERROR SIMULATION $objXtpo = new Test('hi'); }catch(Exception $e){ echo('Exception is: '. $e->getErrorMessage()); } Expected result: ---------------- Exception is: Error Simulation Actual result: -------------- Exception is: