forked from krakjoe/pthreads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatics-thorn-in-other-side.phpt
58 lines (50 loc) · 1014 Bytes
/
statics-thorn-in-other-side.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--TEST--
Test statics aren't getting fucked with when starting new threads (many bugs)
--FILE--
<?php
class StaticClass{
public static $list = array();
public static $test;
public static $testObject;
public function __construct(){
self::$list[] = $this;
self::$test = "randomvalue";
}
}
class ThreadClass extends Thread{
}
new StaticClass;
StaticClass::$testObject = new StaticClass;
echo "BEFORE:\n";
var_dump(StaticClass::$list, StaticClass::$test, StaticClass::$testObject);
echo "\n";
$thread = new ThreadClass;
$thread->start();
echo "AFTER\n";
var_dump(StaticClass::$list, StaticClass::$test, StaticClass::$testObject);
echo "\n";
--EXPECTF--
BEFORE:
array(2) {
[0]=>
object(StaticClass)#1 (0) {
}
[1]=>
object(StaticClass)#2 (0) {
}
}
string(11) "randomvalue"
object(StaticClass)#2 (0) {
}
AFTER
array(2) {
[0]=>
object(StaticClass)#1 (0) {
}
[1]=>
object(StaticClass)#2 (0) {
}
}
string(11) "randomvalue"
object(StaticClass)#2 (0) {
}