Skip to content

Commit 5fc96c5

Browse files
committed
(unset) casts are no longer supported since PHP 8
1 parent dc2e8d9 commit 5fc96c5

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

spec/10-expressions.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,10 @@ cast-type: one of
18881888
real string unset
18891889
</pre>
18901890

1891+
**Constaints**
1892+
1893+
A *cast-type* of `unset` is no longer supported and results in a compile-time error.
1894+
18911895
**Semantics**
18921896

18931897
With the exception of the *cast-type* unset and binary (see below), the
@@ -1914,9 +1918,6 @@ A *cast-type* of `object` results in a [conversion to type `object`](08-conversi
19141918

19151919
A *cast-type* of `string` results in a [conversion to type `string`](08-conversions.md#converting-to-string-type).
19161920

1917-
A *cast-type* of `unset` always results in a value of `NULL`. (This use of
1918-
`unset` should not be confused with the [`unset` statement](11-statements.md#the-unset-statement).
1919-
19201921
**Examples**
19211922

19221923
```PHP

tests/expressions/unary_operators/cast.phpt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ echo var_dump((binary)"");
2929
echo var_dump((binary)"abcdef");
3030

3131
echo var_dump($v);
32-
echo var_dump((unset)$v);
33-
echo var_dump($v);
32+
33+
// The (unset) cast is no longer supported
34+
//echo var_dump((unset)$v);
35+
//echo var_dump($v);
3436
//*/
3537

3638
///*
@@ -146,7 +148,6 @@ var_dump($binStr);
146148
$binStr = b"AaBb123$%^";
147149
var_dump($binStr);
148150
--EXPECTF--
149-
Deprecated: The (unset) cast is deprecated in %s on line %d
150151
bool(false)
151152
bool(false)
152153
int(0)
@@ -167,8 +168,6 @@ string(1) "0"
167168
string(0) ""
168169
string(6) "abcdef"
169170
int(0)
170-
NULL
171-
int(0)
172171
int(10)
173172
bool(true)
174173
bool(true)
@@ -456,7 +455,7 @@ array(2) {
456455
int(1)
457456
float(1)
458457

459-
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line 50
458+
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line %d
460459
string(5) "Array"
461460
array(2) {
462461
[5]=>
@@ -485,7 +484,7 @@ array(4) {
485484
int(1)
486485
float(1)
487486

488-
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line 50
487+
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line %d
489488
string(5) "Array"
490489
array(4) {
491490
[0]=>
@@ -555,7 +554,7 @@ object(E)#3 (3) {
555554
$key: >Epriv_prop<, len: 12, $val: ><
556555
$key: >*prot_prop<, len: 12, $val: >12.345<
557556
558-
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line 115
557+
Notice: Array to string conversion in %s/expressions/unary_operators/cast.php on line %d
559558
$key: >publ_prop<, len: 9, $val: >Array<
560559
---------------
561560
resource(1) of type (stream)

0 commit comments

Comments
 (0)