forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--TEST-- | ||
Appending containers via a binary RW op $c[] .= $v; | ||
--FILE-- | ||
<?php | ||
|
||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'test_offset_helpers.inc'; | ||
|
||
foreach ($containers as $container) { | ||
echo zend_test_var_export($container), " container:\n"; | ||
try { | ||
$container[] .= 'value'; | ||
var_dump($container); | ||
} catch (\Throwable $e) { | ||
echo $e::class, ': ', $e->getMessage(), "\n"; | ||
} | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
NULL container: | ||
array(1) { | ||
[0]=> | ||
string(5) "value" | ||
} | ||
false container: | ||
|
||
Deprecated: Automatic conversion of false to array is deprecated in %s on line %d | ||
array(1) { | ||
[0]=> | ||
string(5) "value" | ||
} | ||
true container: | ||
Error: Cannot use a scalar value as an array | ||
4 container: | ||
Error: Cannot use a scalar value as an array | ||
5.5 container: | ||
Error: Cannot use a scalar value as an array | ||
'10' container: | ||
Error: [] operator not supported for strings | ||
'25.5' container: | ||
Error: [] operator not supported for strings | ||
'string' container: | ||
Error: [] operator not supported for strings | ||
[] container: | ||
array(1) { | ||
[0]=> | ||
string(5) "value" | ||
} | ||
STDERR container: | ||
Error: Cannot use a scalar value as an array | ||
new stdClass() container: | ||
Error: Cannot use object of type stdClass as array | ||
new ArrayObject() container: | ||
object(ArrayObject)#2 (1) { | ||
["storage":"ArrayObject":private]=> | ||
array(1) { | ||
[0]=> | ||
string(5) "value" | ||
} | ||
} | ||
new A() container: | ||
string(12) "A::offsetGet" | ||
NULL | ||
|
||
Notice: Indirect modification of overloaded element of A has no effect in %s on line %d | ||
object(A)#3 (0) { | ||
} | ||
new B() container: | ||
object(B)#4 (1) { | ||
["storage":"ArrayObject":private]=> | ||
array(1) { | ||
[0]=> | ||
string(5) "value" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters