Skip to content

Commit 9092858

Browse files
committed
Add unset()
1 parent 67265dd commit 9092858

8 files changed

+45
-1
lines changed

Zend/tests/offsets/array_container_offset_behaviour.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ empty():
2020
bool(false)
2121
Coalesce():
2222
string(7) "vappend"
23+
unset():
2324
2425
OUTPUT;
2526

@@ -54,6 +55,9 @@ Coalesce():
5455
5556
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
5657
string(7) "vappend"
58+
unset():
59+
60+
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 54
5761
5862
OUTPUT;
5963

Zend/tests/offsets/false_container_offset_behaviour.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ empty():
2222
bool(false)
2323
Coalesce():
2424
string(7) "vappend"
25+
unset():
2526
2627
OUTPUT;
2728

@@ -54,6 +55,9 @@ Coalesce():
5455
5556
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
5657
string(7) "vappend"
58+
unset():
59+
60+
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 54
5761
5862
OUTPUT;
5963

@@ -78,6 +82,8 @@ empty():
7882
Cannot access offset of type %s in isset or empty
7983
Coalesce():
8084
Cannot access offset of type %s on array
85+
unset():
86+
Cannot unset offset in a non-array variable
8187
8288
OUTPUT;
8389

Zend/tests/offsets/invalid_container_offset_behaviour.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ empty():
3636
bool(true)
3737
Coalesce():
3838
string(7) "default"
39+
unset():
40+
Cannot unset offset in a non-array variable
3941
4042
OUTPUT;
4143

Zend/tests/offsets/null_container_offset_behaviour.phpt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ empty():
2020
bool(false)
2121
Coalesce():
2222
string(7) "vappend"
23+
unset():
2324
2425
OUTPUT;
2526

@@ -50,6 +51,9 @@ Coalesce():
5051
5152
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
5253
string(7) "vappend"
54+
unset():
55+
56+
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 54
5357
5458
OUTPUT;
5559

@@ -72,6 +76,7 @@ empty():
7276
Cannot access offset of type %s in isset or empty
7377
Coalesce():
7478
Cannot access offset of type %s on array
79+
unset():
7580
7681
OUTPUT;
7782

Zend/tests/offsets/object_container_offset_behaviour.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ empty():
2020
Cannot use object of type stdClass as array
2121
Coalesce():
2222
Cannot use object of type stdClass as array
23+
unset():
24+
Cannot use object of type stdClass as array
2325
2426
OUTPUT;
2527

@@ -38,7 +40,8 @@ foreach ($offsets as $dimension) {
3840
);
3941

4042
if ($varOutput !== EXPECTED_OUTPUT) {
41-
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_object_container_{$failuresNb}.txt", $varOutput);
43+
file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_object_container.txt", $varOutput);
44+
//file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . "debug_object_container_{$failuresNb}.txt", $varOutput);
4245
++$failuresNb;
4346
$failures[] = $error;
4447
}

Zend/tests/offsets/runtime_compile_time_offset_access.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ try {
8181
} catch (\Throwable \$e) {
8282
echo \$e->getMessage(), "\\n";
8383
}
84+
try {
85+
echo "unset():\\n";
86+
unset(\$container[$offset_p]);
87+
} catch (\Throwable \$e) {
88+
echo \$e->getMessage(), "\\n";
89+
}
8490
test;
8591
return $fileContent;
8692
}

Zend/tests/offsets/string_container_offset_behaviour.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ empty():
2323
bool(false)
2424
Coalesce():
2525
string(1) "v"
26+
unset():
27+
Cannot unset string offsets
2628
2729
OUTPUT;
2830

@@ -52,6 +54,8 @@ empty():
5254
bool(false)
5355
Coalesce():
5456
string(1) "v"
57+
unset():
58+
Cannot unset string offsets
5559
5660
OUTPUT;
5761

@@ -87,6 +91,8 @@ Coalesce():
8791
8892
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
8993
string(7) "vappend"
94+
unset():
95+
Cannot unset string offsets
9096
9197
OUTPUT;
9298

@@ -107,6 +113,8 @@ empty():
107113
bool(true)
108114
Coalesce():
109115
Cannot access offset of type %s on string
116+
unset():
117+
Cannot unset string offsets
110118
111119
OUTPUT;
112120

@@ -127,6 +135,8 @@ empty():
127135
bool(true)
128136
Coalesce():
129137
string(7) "default"
138+
unset():
139+
Cannot unset string offsets
130140
131141
OUTPUT;
132142

@@ -156,6 +166,8 @@ Coalesce():
156166
157167
Warning: Illegal string offset %s in %s on line 48
158168
string(1) "v"
169+
unset():
170+
Cannot unset string offsets
159171
160172
OUTPUT;
161173

Zend/tests/offsets/test_variable_offsets.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,9 @@ try {
4949
} catch (\Throwable $e) {
5050
echo $e->getMessage(), "\n";
5151
}
52+
try {
53+
echo "unset():\n";
54+
unset($container[$dimension]);
55+
} catch (\Throwable $e) {
56+
echo $e->getMessage(), "\n";
57+
}

0 commit comments

Comments
 (0)