Skip to content

Commit b1c9535

Browse files
committed
Address review comments
1 parent 954abcd commit b1c9535

6 files changed

+90
-416
lines changed

Zend/tests/offsets/appending_containers.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Appending containers
66
require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc';
77

88
foreach ($containers as $container) {
9+
echo zend_test_var_export($container), " container:\n";
910
try {
1011
$container[] = 'value';
1112
var_dump($container);
@@ -16,40 +17,54 @@ foreach ($containers as $container) {
1617

1718
?>
1819
--EXPECTF--
20+
NULL container:
1921
array(1) {
2022
[0]=>
2123
string(5) "value"
2224
}
25+
false container:
2326

2427
Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
2528
array(1) {
2629
[0]=>
2730
string(5) "value"
2831
}
32+
true container:
2933
Cannot use a scalar value as an array
34+
4 container:
3035
Cannot use a scalar value as an array
36+
5.5 container:
3137
Cannot use a scalar value as an array
38+
'10' container:
3239
[] operator not supported for strings
40+
'25.5' container:
3341
[] operator not supported for strings
42+
'string' container:
3443
[] operator not supported for strings
44+
[] container:
3545
array(1) {
3646
[0]=>
3747
string(5) "value"
3848
}
49+
STDERR container:
3950
Cannot use a scalar value as an array
51+
new stdClass() container:
4052
Cannot use object of type stdClass as array
53+
new ArrayObject() container:
4154
object(ArrayObject)#2 (1) {
4255
["storage":"ArrayObject":private]=>
4356
array(1) {
4457
[0]=>
4558
string(5) "value"
4659
}
4760
}
61+
new A() container:
4862
string(12) "A::offsetSet"
4963
NULL
5064
string(5) "value"
5165
object(A)#3 (0) {
5266
}
67+
new B() container:
5368
string(12) "B::offsetSet"
5469
NULL
5570
string(5) "value"

Zend/tests/offsets/appending_containers_in_read.phpt renamed to Zend/tests/offsets/appending_containers_in_fetch.phpt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
--TEST--
2-
Appending containers via a read operation $c[][5] = $v;
2+
Appending containers via a fetch operation $c[][5] = $v;
33
--FILE--
44
<?php
55

66
require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc';
77

88
foreach ($containers as $container) {
9+
echo zend_test_var_export($container), " container:\n";
910
try {
1011
$container[][5] = 'value';
1112
var_dump($container);
@@ -16,13 +17,15 @@ foreach ($containers as $container) {
1617

1718
?>
1819
--EXPECTF--
20+
NULL container:
1921
array(1) {
2022
[0]=>
2123
array(1) {
2224
[5]=>
2325
string(5) "value"
2426
}
2527
}
28+
false container:
2629

2730
Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
2831
array(1) {
@@ -32,28 +35,39 @@ array(1) {
3235
string(5) "value"
3336
}
3437
}
38+
true container:
3539
Error: Cannot use a scalar value as an array
40+
4 container:
3641
Error: Cannot use a scalar value as an array
42+
5.5 container:
3743
Error: Cannot use a scalar value as an array
44+
'10' container:
3845
Error: [] operator not supported for strings
46+
'25.5' container:
3947
Error: [] operator not supported for strings
48+
'string' container:
4049
Error: [] operator not supported for strings
50+
[] container:
4151
array(1) {
4252
[0]=>
4353
array(1) {
4454
[5]=>
4555
string(5) "value"
4656
}
4757
}
58+
STDERR container:
4859
Error: Cannot use a scalar value as an array
60+
new stdClass() container:
4961
Error: Cannot use object of type stdClass as array
62+
new ArrayObject() container:
5063

5164
Notice: Indirect modification of overloaded element of ArrayObject has no effect in %s on line %d
5265
object(ArrayObject)#2 (1) {
5366
["storage":"ArrayObject":private]=>
5467
array(0) {
5568
}
5669
}
70+
new A() container:
5771
string(12) "A::offsetGet"
5872
NULL
5973

@@ -62,6 +76,7 @@ Notice: Indirect modification of overloaded element of A has no effect in %s on
6276
Warning: Only the first byte will be assigned to the string offset in %s on line %d
6377
object(A)#3 (0) {
6478
}
79+
new B() container:
6580

6681
Notice: Indirect modification of overloaded element of B has no effect in %s on line %d
6782
ArgumentCountError: B::offsetGet(): Argument #1 ($offset) not passed

0 commit comments

Comments
 (0)