Annotation of embedaddon/php/tests/lang/bug24658.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #24658 (combo of typehint / reference causes crash)
                      3: --FILE--
                      4: <?php
                      5: class foo {}
                      6: function no_typehint($a) {
                      7:        var_dump($a);
                      8: }
                      9: function typehint(foo $a) {
                     10:        var_dump($a);
                     11: }
                     12: function no_typehint_ref(&$a) {
                     13:        var_dump($a);
                     14: }
                     15: function typehint_ref(foo &$a) {
                     16:        var_dump($a);
                     17: }
                     18: $v = new foo();
                     19: $a = array(new foo(), 1, 2);
                     20: no_typehint($v);
                     21: typehint($v);
                     22: no_typehint_ref($v);
                     23: typehint_ref($v);
                     24: echo "===no_typehint===\n";
                     25: array_walk($a, 'no_typehint');
                     26: echo "===no_typehint_ref===\n";
                     27: array_walk($a, 'no_typehint_ref');
                     28: echo "===typehint===\n";
                     29: array_walk($a, 'typehint');
                     30: echo "===typehint_ref===\n";
                     31: array_walk($a, 'typehint_ref');
                     32: ?>
                     33: --EXPECTF--
                     34: object(foo)#%d (0) {
                     35: }
                     36: object(foo)#%d (0) {
                     37: }
                     38: object(foo)#%d (0) {
                     39: }
                     40: object(foo)#%d (0) {
                     41: }
                     42: ===no_typehint===
                     43: object(foo)#%d (0) {
                     44: }
                     45: int(1)
                     46: int(2)
                     47: ===no_typehint_ref===
                     48: object(foo)#%d (0) {
                     49: }
                     50: int(1)
                     51: int(2)
                     52: ===typehint===
                     53: object(foo)#%d (0) {
                     54: }
                     55: 
                     56: Catchable fatal error: Argument 1 passed to typehint() must be an instance of foo, integer given in %s on line %d

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