Annotation of embedaddon/php/ext/standard/tests/general_functions/bug40398.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #40398 (parent and self callback functions erroneously called statically)
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class Base
                      7: {
                      8:        function __construct($msg)
                      9:        {
                     10:                echo __METHOD__ . "($msg)\n";
                     11:        }
                     12: }
                     13: 
                     14: class Derived_1 extends Base
                     15: {
                     16:        public function __construct()
                     17:        {
                     18:                $args = func_get_args();
                     19:                call_user_func_array(array($this, 'Base::__construct'), $args);
                     20:        }
                     21: }
                     22: 
                     23: class Derived_2 extends Base
                     24: {
                     25:        public function __construct()
                     26:        {
                     27:                $args = func_get_args();
                     28:                call_user_func_array(array($this, 'parent::__construct'), $args);
                     29:        }
                     30: }
                     31: 
                     32: class Derived_3 extends Base
                     33: {
                     34:        public function __construct()
                     35:        {
                     36:                $args = func_get_args();
                     37:                call_user_func_array('Base::__construct', $args);
                     38:        }
                     39: }
                     40: 
                     41: class Derived_4 extends Base
                     42: {
                     43:        public function __construct()
                     44:        {
                     45:                $args = func_get_args();
                     46:                call_user_func_array('parent::__construct', $args);
                     47:        }
                     48: }
                     49: 
                     50: class Derived_5 extends Base
                     51: {
                     52:        public function __construct()
                     53:        {
                     54:                $args = func_get_args();
                     55:                call_user_func_array(array('Base', '__construct'), $args);
                     56:        }
                     57: }
                     58: 
                     59: class Derived_6 extends Base
                     60: {
                     61:        public function __construct()
                     62:        {
                     63:                $args = func_get_args();
                     64:                call_user_func_array(array('parent', '__construct'), $args);
                     65:        }
                     66: }
                     67: 
                     68: new Derived_1('1');
                     69: new Derived_2('2');
                     70: new Derived_3('3');
                     71: new Derived_4('4');
                     72: new Derived_5('5');
                     73: new Derived_6('6');
                     74: 
                     75: ?>
                     76: ===DONE===
                     77: --EXPECTF--
                     78: Base::__construct(1)
                     79: Base::__construct(2)
                     80: Base::__construct(3)
                     81: Base::__construct(4)
                     82: Base::__construct(5)
                     83: Base::__construct(6)
                     84: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>