Skip to content

Commit e4d959b

Browse files
committed
Remove test dependency on resource/object IDs
1 parent f73d65b commit e4d959b

10 files changed

+76
-121
lines changed

Zend/tests/type_declarations/scalar_return_basic.phpt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $values = [
4444
[],
4545
new StdClass,
4646
new StringCapable,
47-
fopen("data:text/plain,foobar", "r")
47+
STDERR,
4848
];
4949

5050
foreach ($functions as $type => $function) {
@@ -92,13 +92,13 @@ int(0)
9292
*** Trying array(0) {
9393
}
9494
*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
95-
*** Trying object(stdClass)#6 (0) {
95+
*** Trying object(stdClass)#%d (0) {
9696
}
9797
*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
98-
*** Trying object(StringCapable)#7 (0) {
98+
*** Trying object(StringCapable)#%d (0) {
9999
}
100100
*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
101-
*** Trying resource(5) of type (stream)
101+
*** Trying resource(%d) of type (stream)
102102
*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
103103

104104
Testing 'float' type:
@@ -129,13 +129,13 @@ float(0)
129129
*** Trying array(0) {
130130
}
131131
*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
132-
*** Trying object(stdClass)#6 (0) {
132+
*** Trying object(stdClass)#%d (0) {
133133
}
134134
*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
135-
*** Trying object(StringCapable)#7 (0) {
135+
*** Trying object(StringCapable)#%d (0) {
136136
}
137137
*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
138-
*** Trying resource(5) of type (stream)
138+
*** Trying resource(%d) of type (stream)
139139
*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
140140

141141
Testing 'string' type:
@@ -166,13 +166,13 @@ string(0) ""
166166
*** Trying array(0) {
167167
}
168168
*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
169-
*** Trying object(stdClass)#6 (0) {
169+
*** Trying object(stdClass)#%d (0) {
170170
}
171171
*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
172-
*** Trying object(StringCapable)#7 (0) {
172+
*** Trying object(StringCapable)#%d (0) {
173173
}
174174
string(6) "foobar"
175-
*** Trying resource(5) of type (stream)
175+
*** Trying resource(%d) of type (stream)
176176
*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
177177

178178
Testing 'bool' type:
@@ -203,13 +203,13 @@ bool(false)
203203
*** Trying array(0) {
204204
}
205205
*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
206-
*** Trying object(stdClass)#6 (0) {
206+
*** Trying object(stdClass)#%d (0) {
207207
}
208208
*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
209-
*** Trying object(StringCapable)#7 (0) {
209+
*** Trying object(StringCapable)#%d (0) {
210210
}
211211
*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
212-
*** Trying resource(5) of type (stream)
212+
*** Trying resource(%d) of type (stream)
213213
*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
214214

215215
Done

Zend/tests/type_declarations/scalar_return_basic_64bit.phpt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $values = [
4444
[],
4545
new StdClass,
4646
new StringCapable,
47-
fopen("data:text/plain,foobar", "r")
47+
STDERR,
4848
];
4949

5050
foreach ($functions as $type => $function) {
@@ -92,13 +92,13 @@ int(0)
9292
*** Trying array(0) {
9393
}
9494
*** Caught {closure:%s:%d}(): Return value must be of type int, array returned in %s on line %d
95-
*** Trying object(stdClass)#6 (0) {
95+
*** Trying object(stdClass)#%d (0) {
9696
}
9797
*** Caught {closure:%s:%d}(): Return value must be of type int, stdClass returned in %s on line %d
98-
*** Trying object(StringCapable)#7 (0) {
98+
*** Trying object(StringCapable)#%d (0) {
9999
}
100100
*** Caught {closure:%s:%d}(): Return value must be of type int, StringCapable returned in %s on line %d
101-
*** Trying resource(5) of type (stream)
101+
*** Trying resource(%d) of type (stream)
102102
*** Caught {closure:%s:%d}(): Return value must be of type int, resource returned in %s on line %d
103103

104104
Testing 'float' type:
@@ -129,13 +129,13 @@ float(0)
129129
*** Trying array(0) {
130130
}
131131
*** Caught {closure:%s:%d}(): Return value must be of type float, array returned in %s on line %d
132-
*** Trying object(stdClass)#6 (0) {
132+
*** Trying object(stdClass)#%d (0) {
133133
}
134134
*** Caught {closure:%s:%d}(): Return value must be of type float, stdClass returned in %s on line %d
135-
*** Trying object(StringCapable)#7 (0) {
135+
*** Trying object(StringCapable)#%d (0) {
136136
}
137137
*** Caught {closure:%s:%d}(): Return value must be of type float, StringCapable returned in %s on line %d
138-
*** Trying resource(5) of type (stream)
138+
*** Trying resource(%d) of type (stream)
139139
*** Caught {closure:%s:%d}(): Return value must be of type float, resource returned in %s on line %d
140140

141141
Testing 'string' type:
@@ -166,13 +166,13 @@ string(0) ""
166166
*** Trying array(0) {
167167
}
168168
*** Caught {closure:%s:%d}(): Return value must be of type string, array returned in %s on line %d
169-
*** Trying object(stdClass)#6 (0) {
169+
*** Trying object(stdClass)#%d (0) {
170170
}
171171
*** Caught {closure:%s:%d}(): Return value must be of type string, stdClass returned in %s on line %d
172-
*** Trying object(StringCapable)#7 (0) {
172+
*** Trying object(StringCapable)#%d (0) {
173173
}
174174
string(6) "foobar"
175-
*** Trying resource(5) of type (stream)
175+
*** Trying resource(%d) of type (stream)
176176
*** Caught {closure:%s:%d}(): Return value must be of type string, resource returned in %s on line %d
177177

178178
Testing 'bool' type:
@@ -203,13 +203,13 @@ bool(false)
203203
*** Trying array(0) {
204204
}
205205
*** Caught {closure:%s:%d}(): Return value must be of type bool, array returned in %s on line %d
206-
*** Trying object(stdClass)#6 (0) {
206+
*** Trying object(stdClass)#%d (0) {
207207
}
208208
*** Caught {closure:%s:%d}(): Return value must be of type bool, stdClass returned in %s on line %d
209-
*** Trying object(StringCapable)#7 (0) {
209+
*** Trying object(StringCapable)#%d (0) {
210210
}
211211
*** Caught {closure:%s:%d}(): Return value must be of type bool, StringCapable returned in %s on line %d
212-
*** Trying resource(5) of type (stream)
212+
*** Trying resource(%d) of type (stream)
213213
*** Caught {closure:%s:%d}(): Return value must be of type bool, resource returned in %s on line %d
214214

215215
Done

Zend/tests/type_declarations/scalar_strict.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ int(2147483647)
9696
}
9797
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
9898

99-
*** Trying object(stdClass)#5 (0) {
99+
*** Trying object(stdClass)#%d (0) {
100100
}
101101
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
102102

103-
*** Trying object(StringCapable)#6 (0) {
103+
*** Trying object(StringCapable)#%d (0) {
104104
}
105105
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
106106

107-
*** Trying resource(5) of type (stream)
107+
*** Trying resource(%d) of type (stream)
108108
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
109109

110110
Testing 'float' type:
@@ -149,15 +149,15 @@ float(NAN)
149149
}
150150
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
151151

152-
*** Trying object(stdClass)#5 (0) {
152+
*** Trying object(stdClass)#%d (0) {
153153
}
154154
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
155155

156-
*** Trying object(StringCapable)#6 (0) {
156+
*** Trying object(StringCapable)#%d (0) {
157157
}
158158
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
159159

160-
*** Trying resource(5) of type (stream)
160+
*** Trying resource(%d) of type (stream)
161161
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
162162

163163
Testing 'string' type:
@@ -202,15 +202,15 @@ string(0) ""
202202
}
203203
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
204204

205-
*** Trying object(stdClass)#5 (0) {
205+
*** Trying object(stdClass)#%d (0) {
206206
}
207207
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
208208

209-
*** Trying object(StringCapable)#6 (0) {
209+
*** Trying object(StringCapable)#%d (0) {
210210
}
211211
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
212212

213-
*** Trying resource(5) of type (stream)
213+
*** Trying resource(%d) of type (stream)
214214
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
215215

216216
Testing 'bool' type:
@@ -255,15 +255,15 @@ bool(false)
255255
}
256256
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
257257

258-
*** Trying object(stdClass)#5 (0) {
258+
*** Trying object(stdClass)#%d (0) {
259259
}
260260
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
261261

262-
*** Trying object(StringCapable)#6 (0) {
262+
*** Trying object(StringCapable)#%d (0) {
263263
}
264264
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
265265

266-
*** Trying resource(5) of type (stream)
266+
*** Trying resource(%d) of type (stream)
267267
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
268268

269269
Done

Zend/tests/type_declarations/scalar_strict_64bit.phpt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $values = [
3535
[],
3636
new StdClass,
3737
new StringCapable,
38-
fopen("data:text/plain,foobar", "r")
38+
STDERR,
3939
];
4040

4141
foreach ($functions as $type => $function) {
@@ -96,15 +96,15 @@ int(9223372036854775807)
9696
}
9797
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, array given, called in %s on line %d
9898

99-
*** Trying object(stdClass)#5 (0) {
99+
*** Trying object(stdClass)#%d (0) {
100100
}
101101
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, stdClass given, called in %s on line %d
102102

103-
*** Trying object(StringCapable)#6 (0) {
103+
*** Trying object(StringCapable)#%d (0) {
104104
}
105105
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, StringCapable given, called in %s on line %d
106106

107-
*** Trying resource(5) of type (stream)
107+
*** Trying resource(%d) of type (stream)
108108
*** Caught {closure:%s:%d}(): Argument #1 ($i) must be of type int, resource given, called in %s on line %d
109109

110110
Testing 'float' type:
@@ -149,15 +149,15 @@ float(NAN)
149149
}
150150
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, array given, called in %s on line %d
151151

152-
*** Trying object(stdClass)#5 (0) {
152+
*** Trying object(stdClass)#%d (0) {
153153
}
154154
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, stdClass given, called in %s on line %d
155155

156-
*** Trying object(StringCapable)#6 (0) {
156+
*** Trying object(StringCapable)#%d (0) {
157157
}
158158
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, StringCapable given, called in %s on line %d
159159

160-
*** Trying resource(5) of type (stream)
160+
*** Trying resource(%d) of type (stream)
161161
*** Caught {closure:%s:%d}(): Argument #1 ($f) must be of type float, resource given, called in %s on line %d
162162

163163
Testing 'string' type:
@@ -202,15 +202,15 @@ string(0) ""
202202
}
203203
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, array given, called in %s on line %d
204204

205-
*** Trying object(stdClass)#5 (0) {
205+
*** Trying object(stdClass)#%d (0) {
206206
}
207207
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, stdClass given, called in %s on line %d
208208

209-
*** Trying object(StringCapable)#6 (0) {
209+
*** Trying object(StringCapable)#%d (0) {
210210
}
211211
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, StringCapable given, called in %s on line %d
212212

213-
*** Trying resource(5) of type (stream)
213+
*** Trying resource(%d) of type (stream)
214214
*** Caught {closure:%s:%d}(): Argument #1 ($s) must be of type string, resource given, called in %s on line %d
215215

216216
Testing 'bool' type:
@@ -255,15 +255,15 @@ bool(false)
255255
}
256256
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, array given, called in %s on line %d
257257

258-
*** Trying object(stdClass)#5 (0) {
258+
*** Trying object(stdClass)#%d (0) {
259259
}
260260
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, stdClass given, called in %s on line %d
261261

262-
*** Trying object(StringCapable)#6 (0) {
262+
*** Trying object(StringCapable)#%d (0) {
263263
}
264264
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, StringCapable given, called in %s on line %d
265265

266-
*** Trying resource(5) of type (stream)
266+
*** Trying resource(%d) of type (stream)
267267
*** Caught {closure:%s:%d}(): Argument #1 ($b) must be of type bool, resource given, called in %s on line %d
268268

269269
Done

ext/opcache/tests/jit/fetch_obj_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ object(stdClass)#%d (2) {
9696
}
9797
object(stdClass)#%d (2) {
9898
["a"]=>
99-
&resource(5) of type (stream)
99+
&resource(%d) of type (stream)
100100
["b"]=>
101101
array(0) {
102102
}
@@ -122,7 +122,7 @@ object(stdClass)#%d (2) {
122122
}
123123
object(stdClass)#%d (2) {
124124
["a"]=>
125-
&resource(6) of type (stream)
125+
&resource(%d) of type (stream)
126126
["b"]=>
127127
array(0) {
128128
}

ext/standard/tests/array/array_map_variation4.phpt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ function callback($a)
1717
$unset_var = 10;
1818
unset ($unset_var);
1919

20-
// get a resource variable
21-
$fp = fopen(__FILE__, "r");
22-
2320
// get a class
2421
class classA{
2522
public function __toString(){
@@ -49,11 +46,11 @@ $arrays = array (
4946
array("hello", $heredoc => "string"), // heredoc
5047

5148
// array with object, unset variable and resource variable
52-
array(@$unset_var => "hello", $fp => 'resource'),
49+
array(@$unset_var => "hello", STDERR => 'resource'),
5350

5451
// array with mixed values
5552
/*11*/ array('hello' => 1, "fruit" => 2.2,
56-
$fp => 'resource', 133 => "int",
53+
STDERR => 'resource', 133 => "int",
5754
@$unset_var => "unset", $heredoc => "heredoc")
5855
);
5956

@@ -70,9 +67,9 @@ echo "Done";
7067
--EXPECTF--
7168
*** Testing array_map() : associative array with diff. keys for 'arr1' argument ***
7269

73-
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
70+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
7471

75-
Warning: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
72+
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line %d
7673
-- Iteration 1 --
7774
array(0) {
7875
}
@@ -131,7 +128,7 @@ array(2) {
131128
array(2) {
132129
[""]=>
133130
string(5) "hello"
134-
[5]=>
131+
[3]=>
135132
string(8) "resource"
136133
}
137134
-- Iteration 9 --
@@ -140,7 +137,7 @@ array(6) {
140137
int(1)
141138
["fruit"]=>
142139
float(2.2)
143-
[5]=>
140+
[3]=>
144141
string(8) "resource"
145142
[133]=>
146143
string(3) "int"

0 commit comments

Comments
 (0)