Skip to content

Commit 5bd9a06

Browse files
committed
Test fixes for increment/decrement change
1 parent 5ea6e25 commit 5bd9a06

File tree

9 files changed

+34
-26
lines changed

9 files changed

+34
-26
lines changed

Zend/tests/bug64417.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class obj implements ArrayAccess {
3232

3333
$o = new obj;
3434
$o['x'] = 1;
35-
++$o['x'];
35+
$ref = &$o['x'];
36+
$ref++;
3637
echo $o['x'], "\n";
3738
?>
3839
--EXPECT--

Zend/tests/in-de-crement/overloaded_access.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ try {
3232
}
3333
?>
3434
--EXPECT--
35-
Cannot increment array
36-
Cannot decrement array
35+
Cannot increment/decrement object offsets
36+
Cannot increment/decrement object offsets

Zend/tests/temporary_cleaning_013.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,7 @@ caught Exception 13
300300

301301
Deprecated: Creation of dynamic property class@anonymous::$foo is deprecated in %s on line %d
302302
caught Exception 14
303-
304-
Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
305303
caught Exception 15
306-
307-
Notice: Indirect modification of overloaded element of ArrayAccess@anonymous has no effect in %s on line %d
308304
caught Exception 16
309305
caught Exception 17
310306
caught Exception 18

Zend/tests/type_declarations/typed_properties_065.phpt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ var_dump($a->foo);
2121
$a[0] .= "e50";
2222
var_dump($a->foo);
2323

24-
$a[0]--;
24+
try {
25+
$a[0]--;
26+
} catch (Error $e) { echo $e->getMessage(), "\n"; }
2527
var_dump($a->foo);
2628

27-
--$a[0];
29+
try {
30+
--$a[0];
31+
} catch (Error $e) { echo $e->getMessage(), "\n"; }
32+
2833
var_dump($a->foo);
2934

3035
$a->foo = PHP_INT_MIN;
@@ -59,13 +64,15 @@ offsetSet(11)
5964
int(1)
6065
offsetSet(1e50)
6166
int(1)
62-
int(0)
63-
int(-1)
64-
Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
67+
Cannot increment/decrement object offsets
68+
int(1)
69+
Cannot increment/decrement object offsets
70+
int(1)
71+
Cannot increment/decrement object offsets
6572
integer
66-
Cannot decrement a reference held by property ArrayAccess@anonymous::$foo of type int past its minimal value
73+
Cannot increment/decrement object offsets
6774
integer
68-
Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
75+
Cannot increment/decrement object offsets
6976
integer
70-
Cannot increment a reference held by property ArrayAccess@anonymous::$foo of type int past its maximal value
77+
Cannot increment/decrement object offsets
7178
integer

Zend/tests/weakrefs/weakmap_basic_map_behavior.phpt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ echo "\nIndirect modification:\n";
5353
$map[$obj] = [];
5454
$map[$obj][] = 42;
5555
$map[$obj2] = 41;
56-
$map[$obj2]++;
56+
try {
57+
$map[$obj2]++;
58+
} catch (Error $e) {
59+
echo $e->getMessage(), "\n";
60+
}
5761
var_dump($map);
5862

5963
echo "\nMethods:\n";
@@ -143,6 +147,7 @@ bool(false)
143147
Object stdClass#2 not contained in WeakMap
144148

145149
Indirect modification:
150+
Cannot increment/decrement object offsets
146151
object(WeakMap)#1 (2) {
147152
[0]=>
148153
array(2) {
@@ -165,7 +170,7 @@ object(WeakMap)#1 (2) {
165170
int(2)
166171
}
167172
["value"]=>
168-
&int(42)
173+
int(41)
169174
}
170175
}
171176

ext/spl/tests/bug70852.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ Bug #70852 Segfault getting NULL offset of an ArrayObject
55
$y = new ArrayObject();
66

77
var_dump($y[NULL]);
8-
var_dump($y[NULL]++);
8+
$ref =& $y[NULL];
9+
var_dump($ref);
910
?>
1011
--EXPECTF--
1112
Warning: Undefined array key "" in %s on line %d
1213
NULL
13-
14-
Warning: Undefined offset in %s on line %d
1514
NULL

ext/spl/tests/fixedarray_014.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
SPL: FixedArray: Trying to access inexistent item
2+
SPL: FixedArray: Trying to access nonexistent item
33
--FILE--
44
<?php
55

@@ -12,4 +12,4 @@ try {
1212

1313
?>
1414
--EXPECT--
15-
OutOfBoundsException: Index invalid or out of range
15+
Error: Cannot increment/decrement object offsets

tests/classes/array_access_003.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ $obj = new ObjectOne;
4141

4242
var_dump($obj[1]);
4343
var_dump($obj[2]);
44-
$obj[2]++;
44+
$ref =& $obj[2];
45+
$ref++;
4546
var_dump($obj[2]);
4647

4748
?>
@@ -50,7 +51,6 @@ ObjectOne::offsetGet(1)
5051
string(6) "fooBar"
5152
ObjectOne::offsetGet(2)
5253
int(1)
53-
ObjectOne::offsetExists(2)
5454
ObjectOne::offsetGet(2)
5555

5656
Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_003.php on line 39

tests/classes/array_access_004.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ $obj = new ObjectOne;
3939

4040
var_dump($obj[1]);
4141
var_dump($obj[2]);
42-
$obj[2]++;
42+
$ref =& $obj[2];
43+
$ref++;
4344
var_dump($obj[2]);
4445

4546
?>
@@ -48,7 +49,6 @@ ObjectOne::offsetGet(1)
4849
string(6) "fooBar"
4950
ObjectOne::offsetGet(2)
5051
int(1)
51-
ObjectOne::offsetExists(2)
5252
ObjectOne::offsetGet(2)
5353

5454
Notice: Indirect modification of overloaded element of ObjectOne has no effect in %sarray_access_004.php on line 39

0 commit comments

Comments
 (0)