|
Comments for: stump20021223.php3
| Message # 1016275: |
|
Date: 04/26/03 02:51
By: Stevenv Vasilogianis Subject: One (more) small flaw > function Base() > { > $this->PEAR(); > > if(get_class($this) == 'base') > { > $this = new PEAR_Error('Base is an abstracted class!'); > } > else > { > $this->db =& DB::connect(BASE_PEAR_DSN,true); > if(DB::isError($this->db)) > { > $this = new PEAR_Error($this->db->getMessage()); This (last quoted line) will cause the destructor to stop working, because $this is no longer a class which contains a _{class name} method. Instead, it is a PEAR_Error object. Here's some proof: <?php require_once('PEAR.php'); class foo extends PEAR { function foo ( ) { $this -> PEAR(); echo "Hello from The Contructor\n"; $this = new PEAR_Error(''); } function _foo ( ) { echo "Hello from The Destructor\n"; } } $foo =& new foo; ?> Gives the ouput: Hello from The Contructor However, removing the line which reassigns $this to a PEAR_Error object produces the expected output: Hello from The Constructor Hello from The Destructor HTH |
Previous Message | Next Message |
| Comments: | ||
| One (more) small flaw | Stevenv Vasilogianis | 04/26/03 02:51 |
| RE: PHPLIB vs. PEAR | David Grinberg | 02/06/03 22:59 |
| One small flaw | Wouter Roosendaal | 02/01/03 12:04 |
| PHP Manual "Classes and Objects" | daniel @drian keeney | 01/31/03 23:58 |
| PHPLIB vs. PEAR | Richard Ruiter | 01/25/03 08:24 |
| DB Inconsistency | Mark Tudor | 01/21/03 18:20 |
| DB Inconsistency | Mark Tudor | 01/21/03 18:20 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


