File: bug0939-001.phpt

package info (click to toggle)
php-mongodb 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,776 kB
  • sloc: ansic: 78,913; xml: 2,277; php: 990; sh: 107; python: 47; pascal: 21; makefile: 2
file content (119 lines) | stat: -rw-r--r-- 2,649 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
--TEST--
PHPC-939: BSON classes should not assign public properties after var_dump()
--FILE--
<?php

$tests = [
    [ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC), ['data', 'type'] ],
    [ new MongoDB\BSON\Decimal128('3.14'), ['dec'] ],
    [ new MongoDB\BSON\Javascript('function foo() { return bar; }', ['bar' => 42]), ['code', 'scope'] ],
    [ new MongoDB\BSON\MaxKey, [] ],
    [ new MongoDB\BSON\MinKey, [] ],
    [ new MongoDB\BSON\ObjectId, ['oid'] ],
    [ new MongoDB\BSON\Regex('foo', 'i'), ['pattern', 'flags'] ],
    [ new MongoDB\BSON\Timestamp(1234, 5678), ['increment', 'timestamp'] ],
    [ new MongoDB\BSON\UTCDateTime, ['milliseconds'] ],
];

foreach ($tests as $test) {
    list($object, $properties) = $test;

    var_dump($object);

    foreach ($properties as $property) {
        var_dump($object->{$property});
    }

    echo "\n";
}

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\BSON\Binary)#%d (%d) {
  ["data"]=>
  string(3) "foo"
  ["type"]=>
  int(0)
}

Notice: Undefined property: MongoDB\BSON\Binary::$data in %s on line %d
NULL

Notice: Undefined property: MongoDB\BSON\Binary::$type in %s on line %d
NULL

object(MongoDB\BSON\Decimal128)#%d (%d) {
  ["dec"]=>
  string(4) "3.14"
}

Notice: Undefined property: MongoDB\BSON\Decimal128::$dec in %s on line %d
NULL

object(MongoDB\BSON\Javascript)#%d (%d) {
  ["code"]=>
  string(30) "function foo() { return bar; }"
  ["scope"]=>
  object(stdClass)#%d (%d) {
    ["bar"]=>
    int(42)
  }
}

Notice: Undefined property: MongoDB\BSON\Javascript::$code in %s on line %d
NULL

Notice: Undefined property: MongoDB\BSON\Javascript::$scope in %s on line %d
NULL

object(MongoDB\BSON\MaxKey)#%d (%d) {
}

object(MongoDB\BSON\MinKey)#%d (%d) {
}

object(MongoDB\BSON\ObjectId)#%d (%d) {
  ["oid"]=>
  string(24) "%x"
}

Notice: Undefined property: MongoDB\BSON\ObjectId::$oid in %s on line %d
NULL

object(MongoDB\BSON\Regex)#%d (%d) {
  ["pattern"]=>
  string(3) "foo"
  ["flags"]=>
  string(1) "i"
}

Notice: Undefined property: MongoDB\BSON\Regex::$pattern in %s on line %d
NULL

Notice: Undefined property: MongoDB\BSON\Regex::$flags in %s on line %d
NULL

object(MongoDB\BSON\Timestamp)#%d (%d) {
  ["increment"]=>
  string(4) "1234"
  ["timestamp"]=>
  string(4) "5678"
}

Notice: Undefined property: MongoDB\BSON\Timestamp::$increment in %s on line %d
NULL

Notice: Undefined property: MongoDB\BSON\Timestamp::$timestamp in %s on line %d
NULL

object(MongoDB\BSON\UTCDateTime)#%d (%d) {
  ["milliseconds"]=>
  string(%d) "%d"
}

Notice: Undefined property: MongoDB\BSON\UTCDateTime::$milliseconds in %s on line %d
NULL

===DONE===