1--TEST--
2Test internal weakmap API
3--EXTENSIONS--
4zend_test
5--FILE--
6<?php
7
8$id1 = new \stdClass;
9$id2 = new \stdClass;
10
11var_dump(zend_weakmap_attach($id1, 1));
12var_dump(zend_weakmap_attach($id1, 3));
13var_dump(zend_weakmap_attach($id2, 2));
14
15var_dump(zend_weakmap_dump());
16
17unset($id1);
18
19var_dump(zend_weakmap_dump());
20
21var_dump(zend_weakmap_remove($id2));
22var_dump(zend_weakmap_remove($id2));
23
24var_dump(zend_weakmap_dump());
25
26var_dump(zend_weakmap_attach($id2, $id2));
27
28var_dump(zend_weakmap_dump());
29
30?>
31--EXPECTF--
32bool(true)
33bool(false)
34bool(true)
35array(2) {
36  [%s]=>
37  int(1)
38  [%s]=>
39  int(2)
40}
41array(1) {
42  [%s]=>
43  int(2)
44}
45bool(true)
46bool(false)
47array(0) {
48}
49bool(true)
50array(1) {
51  [%s]=>
52  object(stdClass)#2 (0) {
53  }
54}
55