1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the sj-i/php-profiler package. |
5
|
|
|
* |
6
|
|
|
* (c) sji <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
declare(strict_types=1); |
13
|
|
|
|
14
|
|
|
namespace PhpProfiler\Inspector\Daemon\Reader\Context; |
15
|
|
|
|
16
|
|
|
use Amp\Parallel\Sync\Channel; |
|
|
|
|
17
|
|
|
use PhpProfiler\Inspector\Daemon\Dispatcher\Message\DetachWorkerMessage; |
18
|
|
|
use PhpProfiler\Inspector\Daemon\Reader\Message\AttachMessage; |
19
|
|
|
use PhpProfiler\Inspector\Daemon\Reader\Message\SetSettingsMessage; |
20
|
|
|
use PhpProfiler\Inspector\Settings\TargetProcessSettings; |
21
|
|
|
use PhpProfiler\Inspector\Daemon\Reader\PhpReaderTask; |
22
|
|
|
use PhpProfiler\Lib\Amphp\ContextEntryPointInterface; |
23
|
|
|
use PhpProfiler\Lib\Process\MemoryReader\MemoryReaderException; |
24
|
|
|
|
25
|
|
|
final class PhpReaderEntryPoint implements ContextEntryPointInterface |
26
|
|
|
{ |
27
|
|
|
private PhpReaderTask $php_reader_task; |
28
|
|
|
|
29
|
|
|
public function __construct(PhpReaderTask $php_reader_task) |
30
|
|
|
{ |
31
|
|
|
$this->php_reader_task = $php_reader_task; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function run(Channel $channel): \Generator |
35
|
|
|
{ |
36
|
|
|
/** @var SetSettingsMessage $set_settings_message */ |
37
|
|
|
$set_settings_message = yield $channel->receive(); |
38
|
|
|
|
39
|
|
|
while (1) { |
40
|
|
|
/** @var AttachMessage $attach_message */ |
41
|
|
|
$attach_message = yield $channel->receive(); |
42
|
|
|
|
43
|
|
|
$target_process_settings = new TargetProcessSettings( |
44
|
|
|
$attach_message->pid |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
try { |
48
|
|
|
yield from $this->php_reader_task->run( |
49
|
|
|
$channel, |
50
|
|
|
$target_process_settings, |
51
|
|
|
$set_settings_message->trace_loop_settings, |
52
|
|
|
$set_settings_message->target_php_settings, |
53
|
|
|
$set_settings_message->get_trace_settings |
54
|
|
|
); |
55
|
|
|
} catch (MemoryReaderException $e) { |
56
|
|
|
// TODO: log errors |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
yield $channel->send( |
60
|
|
|
new DetachWorkerMessage($attach_message->pid) |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths