Skip to content

Commit 88fc23f

Browse files
committed
Use arithmetic operation instead of concat
1 parent c45684e commit 88fc23f

6 files changed

+30
-30
lines changed

Zend/tests/offsets/array_container_offset_behaviour.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Warning: Undefined array key %s in %s on line 8
1212
NULL
1313
Write:
1414
Read:
15-
string(1) "v"
15+
int(5)
1616
Read-Write:
1717
isset():
1818
bool(true)
1919
empty():
2020
bool(false)
2121
null coalesce:
22-
string(7) "vappend"
22+
int(25)
2323
unset():
2424
2525
OUTPUT;
@@ -39,7 +39,7 @@ Deprecated: Implicit conversion from float %F to int loses precision in %s on li
3939
Read:
4040
4141
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 22
42-
string(1) "v"
42+
int(15)
4343
Read-Write:
4444
4545
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 29
@@ -54,7 +54,7 @@ bool(false)
5454
null coalesce:
5555
5656
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
57-
string(7) "vappend"
57+
int(35)
5858
unset():
5959
6060
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 55
@@ -98,7 +98,7 @@ Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 15
9898
Read:
9999
100100
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 22
101-
string(1) "v"
101+
int(5)
102102
Read-Write:
103103
104104
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 29
@@ -113,7 +113,7 @@ bool(false)
113113
null coalesce:
114114
115115
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 48
116-
string(7) "vappend"
116+
int(25)
117117
unset():
118118
119119
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 55

Zend/tests/offsets/false_container_offset_behaviour.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Write:
1414
1515
Deprecated: Automatic conversion of false to array is deprecated in %s on line 15
1616
Read:
17-
string(1) "v"
17+
int(5)
1818
Read-Write:
1919
isset():
2020
bool(true)
2121
empty():
2222
bool(false)
2323
null coalesce:
24-
string(7) "vappend"
24+
int(25)
2525
unset():
2626
2727
OUTPUT;
@@ -39,7 +39,7 @@ Deprecated: Implicit conversion from float %F to int loses precision in %s on li
3939
Read:
4040
4141
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 22
42-
string(1) "v"
42+
int(5)
4343
Read-Write:
4444
4545
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 29
@@ -54,7 +54,7 @@ bool(false)
5454
null coalesce:
5555
5656
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
57-
string(7) "vappend"
57+
int(25)
5858
unset():
5959
6060
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 55
@@ -102,7 +102,7 @@ Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 15
102102
Read:
103103
104104
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 22
105-
string(1) "v"
105+
int(5)
106106
Read-Write:
107107
108108
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 29
@@ -117,7 +117,7 @@ bool(false)
117117
null coalesce:
118118
119119
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 48
120-
string(7) "vappend"
120+
int(25)
121121
unset():
122122
123123
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 55

Zend/tests/offsets/null_container_offset_behaviour.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Warning: Trying to access array offset on null in %s on line 8
1212
NULL
1313
Write:
1414
Read:
15-
string(1) "v"
15+
int(5)
1616
Read-Write:
1717
isset():
1818
bool(true)
1919
empty():
2020
bool(false)
2121
null coalesce:
22-
string(7) "vappend"
22+
int(25)
2323
unset():
2424
2525
OUTPUT;
@@ -35,7 +35,7 @@ Deprecated: Implicit conversion from float %F to int loses precision in %s on li
3535
Read:
3636
3737
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 22
38-
string(1) "v"
38+
int(5)
3939
Read-Write:
4040
4141
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 29
@@ -50,7 +50,7 @@ bool(false)
5050
null coalesce:
5151
5252
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 48
53-
string(7) "vappend"
53+
int(25)
5454
unset():
5555
5656
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 55
@@ -94,7 +94,7 @@ Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 15
9494
Read:
9595
9696
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 22
97-
string(1) "v"
97+
int(5)
9898
Read-Write:
9999
100100
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 29
@@ -109,7 +109,7 @@ bool(false)
109109
null coalesce:
110110
111111
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 48
112-
string(7) "vappend"
112+
int(25)
113113
unset():
114114
115115
Warning: Resource ID#3 used as offset, casting to integer (3) in %s on line 55

Zend/tests/offsets/runtime_compile_time_offset_access.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
// Write
3131
try {
3232
echo "Write:\\n";
33-
\$container[$offset_p] = 'v';
33+
\$container[$offset_p] = 5;
3434
} catch (\Throwable \$e) {
3535
echo \$e->getMessage(), "\\n";
3636
}
@@ -44,7 +44,7 @@ try {
4444
// Read-Write
4545
try {
4646
echo "Read-Write:\\n";
47-
\$container[$offset_p] .= 'append';
47+
\$container[$offset_p] += 20;
4848
} catch (\Throwable \$e) {
4949
echo \$e->getMessage(), "\\n";
5050
}

Zend/tests/offsets/string_container_offset_behaviour.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Warning: Uninitialized string offset %d in %s on line %d
1212
string(0) ""
1313
Write:
1414
Read:
15-
string(1) "v"
15+
string(1) "5"
1616
Read-Write:
1717
Cannot use assign-op operators with string offsets
1818
isset():
1919
bool(true)
2020
empty():
2121
bool(false)
2222
null coalesce:
23-
string(1) "v"
23+
string(1) "5"
2424
unset():
2525
Cannot unset string offsets
2626
@@ -68,7 +68,7 @@ Warning: String offset cast occurred in %s on line 15
6868
Read:
6969
7070
Warning: String offset cast occurred in %s on line 22
71-
string(1) "v"
71+
string(1) "5"
7272
Read-Write:
7373
7474
Warning: String offset cast occurred in %s on line 29
@@ -78,7 +78,7 @@ bool(true)
7878
empty():
7979
bool(false)
8080
null coalesce:
81-
string(1) "v"
81+
string(1) "5"
8282
unset():
8383
Cannot unset string offsets
8484
@@ -134,7 +134,7 @@ Warning: String offset cast occurred in %s on line 15
134134
Read:
135135
136136
Warning: String offset cast occurred in %s on line 22
137-
string(1) "v"
137+
string(1) "5"
138138
Read-Write:
139139
140140
Warning: String offset cast occurred in %s on line 29
@@ -148,7 +148,7 @@ empty():
148148
Deprecated: Implicit conversion from float %F to int loses precision in %s on line 42
149149
bool(false)
150150
null coalesce:
151-
string(1) "v"
151+
string(1) "5"
152152
unset():
153153
Cannot unset string offsets
154154
@@ -250,7 +250,7 @@ Warning: Illegal string offset %s in %s on line 15
250250
Read:
251251
252252
Warning: Illegal string offset %s in %s on line 22
253-
string(1) "v"
253+
string(1) "5"
254254
Read-Write:
255255
256256
Warning: Illegal string offset %s in %s on line 29
@@ -262,7 +262,7 @@ bool(true)
262262
null coalesce:
263263
264264
Warning: Illegal string offset %s in %s on line 48
265-
string(1) "v"
265+
string(1) "5"
266266
unset():
267267
Cannot unset string offsets
268268

Zend/tests/offsets/test_variable_offsets.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ try {
1212
// Write
1313
try {
1414
echo "Write:\n";
15-
$container[$dimension] = 'v';
15+
$container[$dimension] = 5;
1616
} catch (\Throwable $e) {
1717
echo $e->getMessage(), "\n";
1818
}
@@ -26,7 +26,7 @@ try {
2626
// Read-Write
2727
try {
2828
echo "Read-Write:\n";
29-
$container[$dimension] .= 'append';
29+
$container[$dimension] += 20;
3030
} catch (\Throwable $e) {
3131
echo $e->getMessage(), "\n";
3232
}

0 commit comments

Comments
 (0)