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.
Indirect support for fetching address
- Loading branch information
Showing
5 changed files
with
53 additions
and
44 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
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
44 changes: 25 additions & 19 deletions
44
ext/spl/tests/ArrayObject/indirect_assign_reference_to_offset.phpt
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 |
---|---|---|
@@ -1,45 +1,51 @@ | ||
--TEST-- | ||
Bug #73686 (Adding settype()ed values to ArrayObject results in references) | ||
Setting indirections must work for ArrayObject | ||
--FILE-- | ||
<?php | ||
|
||
$ao = new ArrayObject; | ||
// Based on test file for Bug #73686 | ||
|
||
echo "Using array\n"; | ||
$a = []; | ||
foreach ([1, 2, 3] as $i => $var) | ||
{ | ||
settype($var, 'string'); | ||
$ao[$i] = $var; | ||
$a[$i] = &$var; | ||
} | ||
var_dump($ao); | ||
$a[] = &$var; | ||
var_dump($a); | ||
|
||
echo "Using ArrayObject\n"; | ||
$ao = new ArrayObject; | ||
|
||
foreach ([1, 2, 3] as $i => $var) | ||
{ | ||
$ao[$i] = &$var; | ||
} | ||
$ao[] = &$var; | ||
var_dump($ao); | ||
?> | ||
--EXPECTF-- | ||
object(ArrayObject)#%d (1) { | ||
["storage":"ArrayObject":private]=> | ||
array(3) { | ||
[0]=> | ||
string(1) "1" | ||
[1]=> | ||
string(1) "2" | ||
[2]=> | ||
string(1) "3" | ||
} | ||
--EXPECT-- | ||
Using array | ||
array(4) { | ||
[0]=> | ||
&int(3) | ||
[1]=> | ||
&int(3) | ||
[2]=> | ||
&int(3) | ||
[3]=> | ||
&int(3) | ||
} | ||
object(ArrayObject)#%d (1) { | ||
Using ArrayObject | ||
object(ArrayObject)#1 (1) { | ||
["storage":"ArrayObject":private]=> | ||
array(3) { | ||
array(4) { | ||
[0]=> | ||
&int(3) | ||
[1]=> | ||
&int(3) | ||
[2]=> | ||
&int(3) | ||
[3]=> | ||
&int(3) | ||
} | ||
} |
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