-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathproperty_exists.phpt
107 lines (97 loc) · 3.53 KB
/
property_exists.phpt
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
--TEST--
Test V8::executeString() : property_exists/isset/empty on wrapped JS objects
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$JS = <<< EOT
(function(exports) {
// begin module code
exports.hello = function() { return 'hello'; };
exports.isnull = null;
exports.isundefined = undefined;
exports.isfalse = false;
exports.iszero = 0;
exports.isquotezero = '0';
exports.isemptyarray = [];
exports.isemptystring = '';
exports.istrue = true;
// end module code
return exports;
})({})
EOT;
$exports = $v8->executeString($JS, 'basic.js');
echo "= isset() =\n";
echo "bogus: "; var_dump(isset( $exports->bogus ));
echo "hello: "; var_dump(isset( $exports->hello ));
echo "isnull: "; var_dump(isset( $exports->isnull ));
echo "isundefined: "; var_dump(isset( $exports->isundefined ));
echo "isfalse: "; var_dump(isset( $exports->isfalse ));
echo "iszero: "; var_dump(isset( $exports->iszero ));
echo "isquotezero: "; var_dump(isset( $exports->isquotezero ));
echo "isemptyarray: "; var_dump(isset( $exports->isemptyarray ));
echo "isemptystring: "; var_dump(isset( $exports->isemptystring ));
echo "istrue: "; var_dump(isset( $exports->istrue ));
echo "\n";
echo "= empty() =\n";
echo "bogus: "; var_dump(empty( $exports->bogus ));
echo "hello: "; var_dump(empty( $exports->hello ));
echo "isnull: "; var_dump(empty( $exports->isnull ));
echo "isundefined: "; var_dump(empty( $exports->isundefined ));
echo "isfalse: "; var_dump(empty( $exports->isfalse ));
echo "iszero: "; var_dump(empty( $exports->iszero ));
echo "isquotezero: "; var_dump(empty( $exports->isquotezero ));
echo "isemptyarray: "; var_dump(empty( $exports->isemptyarray ));
echo "isemptystring: "; var_dump(empty( $exports->isemptystring ));
echo "istrue: "; var_dump(empty( $exports->istrue ));
echo "\n";
echo "= property_exists() =\n";
echo "bogus: "; var_dump(property_exists( $exports, 'bogus' ));
echo "hello: "; var_dump(property_exists( $exports, 'hello' ));
echo "isnull: "; var_dump(property_exists( $exports, 'isnull' ));
echo "isundefined: "; var_dump(property_exists( $exports, 'isundefined' ));
echo "isfalse: "; var_dump(property_exists( $exports, 'isfalse' ));
echo "iszero: "; var_dump(property_exists( $exports, 'iszero' ));
echo "isquotezero: "; var_dump(property_exists( $exports, 'isquotezero' ));
echo "isemptyarray: "; var_dump(property_exists( $exports, 'isemptyarray' ));
echo "isemptystring: "; var_dump(property_exists( $exports, 'isemptystring' ));
echo "istrue: "; var_dump(property_exists( $exports, 'istrue' ));
echo "\n";
?>
===EOF===
--EXPECT--
= isset() =
bogus: bool(false)
hello: bool(true)
isnull: bool(false)
isundefined: bool(false)
isfalse: bool(true)
iszero: bool(true)
isquotezero: bool(true)
isemptyarray: bool(true)
isemptystring: bool(true)
istrue: bool(true)
= empty() =
bogus: bool(true)
hello: bool(false)
isnull: bool(true)
isundefined: bool(true)
isfalse: bool(true)
iszero: bool(true)
isquotezero: bool(true)
isemptyarray: bool(true)
isemptystring: bool(true)
istrue: bool(false)
= property_exists() =
bogus: bool(false)
hello: bool(true)
isnull: bool(true)
isundefined: bool(true)
isfalse: bool(true)
iszero: bool(true)
isquotezero: bool(true)
isemptyarray: bool(true)
isemptystring: bool(true)
istrue: bool(true)
===EOF===