File: propertyproxy001.phpt

package info (click to toggle)
php-pecl-http 3.1.0%2B2.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,060 kB
  • ctags: 3,725
  • sloc: ansic: 37,486; xml: 818; php: 635; pascal: 164; makefile: 2
file content (100 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--TEST--
property proxy
--SKIPIF--
<?php
include "skipif.inc";
?>
--XFAIL--
TBD
--FILE--
<?php

class m extends http\Message { 
    function test() { 
        $this->headers["bykey"] = 1; 
        var_dump($this->headers); 

        $h = &$this->headers; 
        $h["by1ref"] = 2; 
        var_dump($this->headers); 

        $x = &$this->headers["byXref"];

        $h = &$this->headers["by2ref"]; 
        $h = 1; 
        var_dump($this->headers);

        $x = 2;
        var_dump($this->headers);

        $this->headers["bynext"][] = 1;
        $this->headers["bynext"][] = 2;
        $this->headers["bynext"][] = 3;
        var_dump($this->headers);
    }
} 

$m=new m; 
$m->test(); 
echo $m,"\n";

?>
DONE
--EXPECTF--
array(1) {
  ["bykey"]=>
  int(1)
}
array(2) {
  ["bykey"]=>
  int(1)
  ["by1ref"]=>
  int(2)
}
array(3) {
  ["bykey"]=>
  int(1)
  ["by1ref"]=>
  int(2)
  ["by2ref"]=>
  &int(1)
}
array(4) {
  ["bykey"]=>
  int(1)
  ["by1ref"]=>
  int(2)
  ["by2ref"]=>
  &int(1)
  ["byXref"]=>
  &int(2)
}
array(5) {
  ["bykey"]=>
  int(1)
  ["by1ref"]=>
  int(2)
  ["by2ref"]=>
  &int(1)
  ["byXref"]=>
  &int(2)
  ["bynext"]=>
  array(3) {
    [0]=>
    int(1)
    [1]=>
    int(2)
    [2]=>
    int(3)
  }
}
bykey: 1
by1ref: 2
by2ref: 1
byXref: 2
bynext: 1
bynext: 2
bynext: 3

DONE