cvs: php4 /pear/tests pear1.phpt

From: Date: Fri, 11 Jan 2002 00:04:57 +0000
Subject: cvs: php4 /pear/tests pear1.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1904@lists.php.net to get a copy of this message
cox Thu Jan 10 19:04:57 2002 EDT Modified files: /php4/pear/tests pear1.phpt Log: submit a test that will fail due to php bug #14744 Index: php4/pear/tests/pear1.phpt diff -u php4/pear/tests/pear1.phpt:1.2 php4/pear/tests/pear1.phpt:1.3 --- php4/pear/tests/pear1.phpt:1.2 Fri Apr 13 18:24:33 2001 +++ php4/pear/tests/pear1.phpt Thu Jan 10 19:04:55 2002 @@ -8,26 +8,43 @@ class TestPEAR extends PEAR { function TestPEAR($name) { - $this->_debug = true; - $this->name = $name; - $this->PEAR(); + $this->_debug = true; + $this->name = $name; + $this->PEAR(); } function _TestPEAR() { - print "This is the TestPEAR($this->name) destructor\n"; - $this->_PEAR(); + print "This is the TestPEAR($this->name) destructor\n"; + $this->_PEAR(); } } class Test2 extends PEAR { function _Test2() { print "This is the Test2 destructor\n"; - $this->_PEAR(); + $this->_PEAR(); } } class Test3 extends Test2 { } +// test for bug http://bugs.php.net/bug.php?id=14744 +class Other extends Pear { + + var $a = 'default value'; + + function Other() { + $this->PEAR(); + } + + function _Other() { + // $a was modified but here misteriously returns to be + // the original value. That makes the destructor useless + // The correct value for $a in the destructor shoud be "new value" + echo "#bug 14744# Other class destructor: other->a == '" . $this->a ."'\n"; + } +} + print "testing plain destructors\n"; $o = new TestPEAR("test1"); $p = new TestPEAR("test2"); @@ -35,6 +52,13 @@ print "testing inherited destructors\n"; $q = new Test3; +echo "...\ntesting bug #14744\n"; +$other = new Other; +echo "#bug 14744# Other class constructor: other->a == '" . $other->a ."'\n"; +// Modify $a +$other->a = 'new value'; +echo "#bug 14744# Other class modified: other->a == '" . $other->a ."'\n"; + print "..\n"; print "script exiting...\n"; print "..\n"; @@ -48,6 +72,10 @@ PEAR constructor called, class=testpear .. testing inherited destructors +... +testing bug #14744 +#bug 14744# Other class constructor: other->a == 'default value' +#bug 14744# Other class modified: other->a == 'new value' .. script exiting... .. @@ -56,3 +84,4 @@ This is the TestPEAR(test2) destructor PEAR destructor called, class=testpear This is the Test2 destructor +#bug 14744# Other class destructor: other->a == 'new value'

« previous php.pear.cvs (#1904) next »