Annotation of embedaddon/php/ext/reflection/tests/bug42976.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #42976 (Crash when constructor for newInstance() or newInstanceArgs() fails)
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: Class C {
        !             7:        function __construct(&$x) {
        !             8:                $x = "x.changed";
        !             9:        }
        !            10: }
        !            11: 
        !            12: $x = "x.original";
        !            13: new C($x); // OK
        !            14: var_dump($x);
        !            15: 
        !            16: $rc = new ReflectionClass('C');
        !            17: $x = "x.original";
        !            18: $rc->newInstance($x); // causes crash
        !            19: var_dump($x);
        !            20: $x = "x.original";
        !            21: $rc->newInstanceArgs(array($x)); // causes crash       
        !            22: var_dump($x);
        !            23: 
        !            24: echo "Done\n";
        !            25: ?>
        !            26: --EXPECTF--    
        !            27: string(9) "x.changed"
        !            28: 
        !            29: Warning: Parameter 1 to C::__construct() expected to be a reference, value given in %sbug42976.php on line 15
        !            30: 
        !            31: Warning: ReflectionClass::newInstance(): Invocation of C's constructor failed in %sbug42976.php on line 15
        !            32: string(10) "x.original"
        !            33: 
        !            34: Warning: Parameter 1 to C::__construct() expected to be a reference, value given in %sbug42976.php on line 18
        !            35: 
        !            36: Warning: ReflectionClass::newInstanceArgs(): Invocation of C's constructor failed in %sbug42976.php on line 18
        !            37: string(10) "x.original"
        !            38: Done

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