-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmethod_trigger.php
More file actions
60 lines (50 loc) · 1.59 KB
/
Copy pathmethod_trigger.php
File metadata and controls
60 lines (50 loc) · 1.59 KB
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
<?php
/*
* DDLess - PHP Debug Engine
*
* @author Jefferson T.S
* @copyright 2025-2026 DDLess
* @license Proprietary
*
* Method execution entry point. Bootstraps the debug engine and delegates
* to the appropriate framework method executor for direct function/method
* invocation with optional debugging support.
*/
// Defer stream wrapper registration to prevent issues with Laravel bootstrap
$GLOBALS['__DDLESS_DEFER_WRAPPER__'] = true;
if (getenv('DDLESS_DEBUG_MODE') === 'true') {
require_once __DIR__ . '/debug.php';
}
$inputFile = __DIR__ . '/method_input_temp.json';
if (!is_file($inputFile)) {
echo json_encode([
'ok' => false,
'error' => 'Method input file not found: ' . $inputFile,
]);
exit(1);
}
$inputJson = file_get_contents($inputFile);
@unlink($inputFile);
// Signal method_executor to skip stdin reading
$_ENV['DDLESS_METHOD_INPUT_FILE'] = '__ALREADY_LOADED__';
putenv('DDLESS_METHOD_INPUT_FILE=__ALREADY_LOADED__');
$input = json_decode($inputJson, true);
if (json_last_error() !== JSON_ERROR_NONE) {
echo json_encode([
'ok' => false,
'error' => 'Invalid JSON input: ' . json_last_error_msg(),
]);
exit(1);
}
$GLOBALS['__DDLESS_METHOD_INPUT__'] = $inputJson;
$framework = $input['framework'] ?? 'laravel';
$executorPath = __DIR__ . '/frameworks/' . $framework . '/method_executor.php';
if (!is_file($executorPath)) {
echo json_encode([
'ok' => false,
'error' => 'Method executor not found for framework: ' . $framework,
'path' => $executorPath,
]);
exit(1);
}
require_once $executorPath;