Skip to content

Commit 08c8a3b

Browse files
committed
Deprecate type juggling to/from bool for function context
1 parent a468c48 commit 08c8a3b

31 files changed

+513
-278
lines changed

Zend/tests/017.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ var_dump(count(get_defined_functions()));
2828
var_dump(gettype(get_declared_interfaces()));
2929
var_dump(count(get_declared_interfaces()));
3030

31-
var_dump(get_extension_funcs(true));
3231
var_dump(gettype(get_extension_funcs("standard")));
3332
var_dump(count(get_extension_funcs("standard")));
3433
var_dump(gettype(get_extension_funcs("zend")));
@@ -51,7 +50,6 @@ string(5) "array"
5150
int(%d)
5251
string(5) "array"
5352
int(%d)
54-
bool(false)
5553
string(5) "array"
5654
int(%d)
5755
string(5) "array"

Zend/tests/arrow_functions/007.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ try {
1212
}
1313

1414
try {
15-
assert((fn&(int... $args): ?bool => $args[0])(false));
15+
assert((fn&(int... $args): ?int => $args[0])(0));
1616
} catch (AssertionError $e) {
1717
echo 'assert(): ', $e->getMessage(), ' failed', PHP_EOL;
1818
}
1919

2020
?>
2121
--EXPECT--
2222
assert(): assert((fn() => false)()) failed
23-
assert(): assert((fn&(int ...$args): ?bool => $args[0])(false)) failed
23+
assert(): assert((fn&(int ...$args): ?int => $args[0])(0)) failed

Zend/tests/backtrace/debug_backtrace_options.phpt

Lines changed: 3 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ function doit($a, $b, $how)
1616
{
1717
echo "==default\n";
1818
$how();
19-
echo "==true\n";
20-
$how(true);
21-
echo "==false\n";
22-
$how(false);
2319
echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
2420
$how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
2521
echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
@@ -48,14 +44,6 @@ foo::statCall("doit", "backtrace_print");
4844
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
4945
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
5046
#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
51-
==true
52-
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
53-
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
54-
#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
55-
==false
56-
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
57-
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
58-
#2 %sdebug_backtrace_options.php(%d): foo::statCall('doit', 'debug_print_bac...')
5947
==DEBUG_BACKTRACE_PROVIDE_OBJECT
6048
#0 %sdebug_backtrace_options.php(%d): doit('a', 'b', 'debug_print_bac...')
6149
#1 %sdebug_backtrace_options.php(%d): foo->doCall('doit', 'debug_print_bac...')
@@ -130,138 +118,14 @@ Array
130118

131119
)
132120

133-
)
134-
==true
135-
Array
136-
(
137-
[0] => Array
138-
(
139-
[file] => %sdebug_backtrace_options.php
140-
[line] => 17
141-
[function] => backtrace_print
142-
[args] => Array
143-
(
144-
[0] => 1
145-
)
146-
147-
)
148-
149-
[1] => Array
150-
(
151-
[file] => %sdebug_backtrace_options.php
152-
[line] => %d
153-
[function] => doit
154-
[args] => Array
155-
(
156-
[0] => a
157-
[1] => b
158-
[2] => backtrace_print
159-
)
160-
161-
)
162-
163-
[2] => Array
164-
(
165-
[file] => %sdebug_backtrace_options.php
166-
[line] => %d
167-
[function] => doCall
168-
[class] => foo
169-
[object] => foo Object
170-
(
171-
)
172-
173-
[type] => ->
174-
[args] => Array
175-
(
176-
[0] => doit
177-
[1] => backtrace_print
178-
)
179-
180-
)
181-
182-
[3] => Array
183-
(
184-
[file] => %sdebug_backtrace_options.php
185-
[line] => %d
186-
[function] => statCall
187-
[class] => foo
188-
[type] => ::
189-
[args] => Array
190-
(
191-
[0] => doit
192-
[1] => backtrace_print
193-
)
194-
195-
)
196-
197-
)
198-
==false
199-
Array
200-
(
201-
[0] => Array
202-
(
203-
[file] => %sdebug_backtrace_options.php
204-
[line] => 19
205-
[function] => backtrace_print
206-
[args] => Array
207-
(
208-
[0] =>
209-
)
210-
211-
)
212-
213-
[1] => Array
214-
(
215-
[file] => %sdebug_backtrace_options.php
216-
[line] => %d
217-
[function] => doit
218-
[args] => Array
219-
(
220-
[0] => a
221-
[1] => b
222-
[2] => backtrace_print
223-
)
224-
225-
)
226-
227-
[2] => Array
228-
(
229-
[file] => %sdebug_backtrace_options.php
230-
[line] => %d
231-
[function] => doCall
232-
[class] => foo
233-
[type] => ->
234-
[args] => Array
235-
(
236-
[0] => doit
237-
[1] => backtrace_print
238-
)
239-
240-
)
241-
242-
[3] => Array
243-
(
244-
[file] => %sdebug_backtrace_options.php
245-
[line] => %d
246-
[function] => statCall
247-
[class] => foo
248-
[type] => ::
249-
[args] => Array
250-
(
251-
[0] => doit
252-
[1] => backtrace_print
253-
)
254-
255-
)
256-
257121
)
258122
==DEBUG_BACKTRACE_PROVIDE_OBJECT
259123
Array
260124
(
261125
[0] => Array
262126
(
263127
[file] => %sdebug_backtrace_options.php
264-
[line] => 21
128+
[line] => 17
265129
[function] => backtrace_print
266130
[args] => Array
267131
(
@@ -325,7 +189,7 @@ Array
325189
[0] => Array
326190
(
327191
[file] => %sdebug_backtrace_options.php
328-
[line] => 23
192+
[line] => 19
329193
[function] => backtrace_print
330194
)
331195

@@ -361,7 +225,7 @@ Array
361225
[0] => Array
362226
(
363227
[file] => %sdebug_backtrace_options.php
364-
[line] => 25
228+
[line] => 21
365229
[function] => backtrace_print
366230
)
367231

Zend/tests/bug36513.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #36513 (comment will be output in last line)
33
--FILE--
44
<?php
55
function test($s) {
6-
echo "'".trim(str_replace("&nbsp;", " ", htmlspecialchars_decode(strip_tags(highlight_string($s,1)))))."'\n";
6+
echo "'".trim(str_replace("&nbsp;", " ", htmlspecialchars_decode(strip_tags(highlight_string($s, true)))))."'\n";
77
}
88

99
eval('echo "1";//2');

Zend/tests/bug39944.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ addToArray($b, "xx3");
4242
addToArray(getArray(), "xx4");
4343
$a = getArray();
4444
addToArray($a, "xx5");
45-
echo "arrTheArray = " . print_r($arrTheArray, 1);
45+
echo "arrTheArray = " . print_r($arrTheArray, true);
4646

4747
/****/
4848

@@ -69,7 +69,7 @@ $objRefTest->Add("xx1");
6969
$objRefTest->Add("xx2");
7070
$objRefTest->Add("xx3");
7171

72-
echo "objRefTest->getArray() = " . print_r($objRefTest->getArray(), 1);
72+
echo "objRefTest->getArray() = " . print_r($objRefTest->getArray(), true);
7373
?>
7474
--EXPECT--
7575
intTheValue = 10

Zend/tests/bug79022.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #79022 (class_exists returns True for classes that are not ready to be used)
33
--FILE--
44
<?php
55
function my_autoloader($class) {
6-
if (class_exists('Foo', 0)) {
6+
if (class_exists('Foo', false)) {
77
new Foo();
88
}
99
if ($class == 'Foo') {
@@ -19,7 +19,7 @@ function my_autoloader($class) {
1919
}
2020

2121

22-
if (interface_exists('iFoo', 0)) {
22+
if (interface_exists('iFoo', false)) {
2323
new Dummy();
2424
}
2525
if ($class == 'iFoo') {

Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ declare(strict_types=1);
77
namespace Foo;
88

99
// strlen() will be called with strict_types=0, so this is legal.
10-
var_dump(call_user_func('strlen', false));
10+
var_dump(call_user_func('strlen', 25));
1111

1212
?>
1313
--EXPECT--
14-
int(0)
14+
int(2)

Zend/tests/class_alias/class_alias_007.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spl_autoload_register(function ($a) {
77
class foo { }
88
});
99

10-
class_alias('foo', 'bar', 1);
10+
class_alias('foo', 'bar', true);
1111

1212
var_dump(new foo, new bar);
1313

Zend/tests/dynamic_call/bug47880.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #47880 (crashes in call_user_func_array())
44
<?php
55
class bomb {
66
static function go($n) {
7-
$backtrace = debug_backtrace(false);
7+
$backtrace = debug_backtrace(0);
88
$backtrace[1]['args'][1] = 'bomb';
99
}
1010
}

Zend/tests/exit/exit_values.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
exit(false);
2+
Exit with different values
33
--FILE--
44
<?php
55

@@ -84,11 +84,11 @@ Deprecated: exit(): Passing null to parameter #1 ($status) of type string|int is
8484
Using false as value:
8585
Exit status is: 0
8686
Output is:
87-
87+
Deprecated: exit(): Passing bool to parameter #1 ($status) of type string|int is deprecated in %s on line %d
8888
Using true as value:
8989
Exit status is: 1
9090
Output is:
91-
91+
Deprecated: exit(): Passing bool to parameter #1 ($status) of type string|int is deprecated in %s on line %d
9292
Using 0 as value:
9393
Exit status is: 0
9494
Output is:
@@ -136,11 +136,11 @@ Deprecated: exit(): Passing null to parameter #1 ($status) of type string|int is
136136
Using false as value:
137137
Exit status is: 0
138138
Output is:
139-
139+
Deprecated: exit(): Passing bool to parameter #1 ($status) of type string|int is deprecated in %s on line %d
140140
Using true as value:
141141
Exit status is: 1
142142
Output is:
143-
143+
Deprecated: exit(): Passing bool to parameter #1 ($status) of type string|int is deprecated in %s on line %d
144144
Using 0 as value:
145145
Exit status is: 0
146146
Output is:

0 commit comments

Comments
 (0)