-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.php
96 lines (72 loc) · 1.93 KB
/
run.php
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
define('AUTOLOADER', 'autoloader.php');
class Server extends Thread
{
public function __construct()
{
//$this->start(PTHREADS_INHERIT_ALL | PTHREADS_ALLOW_GLOBALS);
}
public function test()
{
return null;
}
public function run()
{
$callback = array($this, 'test');
// it'll work by only doing that too:
// $this;
$a = require 'req01.php';
/*
$b = require 'req02.php';
$c = require 'req03.php';
$d = require 'req04.php';
*/
//var_dump(array_keys($GLOBALS));
$application = new Application();
$application->join();
}
}
class Application extends Thread
{
public function __construct()
{
$this->start(PTHREADS_INHERIT_ALL | PTHREADS_ALLOW_GLOBALS);
}
public function getThis() {
return $this;
}
public function run()
{
$this->afterdump = true;
$x1 = new stdClass();
$x2 = new stdClass();
/*
$a = require 'req01.php';
$b = require 'req02.php';
$c = require 'req03.php';
$d = require 'req04.php';
*/
$GLOBALS['this']->test = 'test';
$GLOBALS['this']->x1 = $x1;
$GLOBALS['this']->x2 = $x2;
//var_dump(array_keys($GLOBALS));
var_dump(get_class($GLOBALS['this']));
usleep(10000);
echo PHP_EOL . '[Application] dumping $GLOBALS[\'server\']:' . PHP_EOL;
var_dump($GLOBALS['server']);
usleep(10000);
echo PHP_EOL . '[Application] dumping $GLOBALS[\'this\']:' . PHP_EOL;
var_dump($GLOBALS['this']);
}
}
$a = [];
for ($i=0; $i<100; $i++) {
$a[] = new stdClass();
}
$server = new Server();
$server->start(PTHREADS_INHERIT_ALL | PTHREADS_ALLOW_GLOBALS);
usleep(5000);
echo PHP_EOL . '[GLOBAL] dumping $server:' . PHP_EOL;
$server->x1 = 'asdf';
var_dump($server);
echo "finished script..." . PHP_EOL;