Skip to content

Commit 5d0ee5b

Browse files
author
Zoe Slattery
committed
array copy on write tests
1 parent 4c22d54 commit 5d0ee5b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Zend/tests/array_append_COW.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Tests that array manipulation code is correctly dealing with copy on write and
3+
splitting on reference.
4+
--FILE--
5+
<?php
6+
$a=array();
7+
$b=1;
8+
$c=&$b;
9+
$a[]=$b;
10+
$b=2;
11+
var_dump ($a);
12+
?>
13+
--EXPECT--
14+
array(1) {
15+
[0]=>
16+
int(1)
17+
}

Zend/tests/array_unshift_COW.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Tests that array unshift code is correctly dealing with copy on write and
3+
splitting on reference.
4+
--FILE--
5+
<?php
6+
$a=array();
7+
$b=1;
8+
$c=&$b;
9+
array_unshift ($a,$b);
10+
$b=2;
11+
var_dump ($a);
12+
?>
13+
--EXPECT--
14+
array(1) {
15+
[0]=>
16+
int(1)
17+
}

0 commit comments

Comments
 (0)