Skip to content

Commit 43362cc

Browse files
committed
Test static var/global interaction
1 parent 1979c06 commit 43362cc

File tree

4 files changed

+45
-24
lines changed

4 files changed

+45
-24
lines changed

Zend/tests/static_variables_closure_bind.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Static variable can't override bound closure variables
2+
Static variable can't override nd closure variables
33
--FILE--
44
<?php
55

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Global can override static variable
3+
--FILE--
4+
<?php
5+
6+
function foo() {
7+
static $a = 42;
8+
var_dump($a);
9+
global $a;
10+
$a = 41;
11+
var_dump($a);
12+
}
13+
14+
foo();
15+
foo();
16+
17+
?>
18+
--EXPECT--
19+
int(42)
20+
int(41)
21+
int(42)
22+
int(41)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Static variable can override global
3+
--FILE--
4+
<?php
5+
6+
function foo() {
7+
global $a;
8+
$a = 42;
9+
var_dump($a);
10+
static $a = 41;
11+
var_dump($a);
12+
}
13+
14+
foo();
15+
foo();
16+
17+
?>
18+
--EXPECT--
19+
int(42)
20+
int(41)
21+
int(42)
22+
int(41)

Zend/tests/static_variables_null.phpt

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)