mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 07:25:30 +02:00
MDL-84879 core: Remove stacktrace args from exceptions
This commit is contained in:
parent
a2374ee968
commit
41917db65e
@ -123,7 +123,10 @@ abstract class exception_response extends \core\router\schema\response\response
|
||||
): array {
|
||||
$data = [
|
||||
'message' => $exception->getMessage(),
|
||||
'stacktrace' => $exception->getTrace(),
|
||||
'stacktrace' => array_map(
|
||||
fn ($frame): array => array_filter($frame, fn ($key) => $key !== 'args', ARRAY_FILTER_USE_KEY),
|
||||
$exception->getTrace(),
|
||||
),
|
||||
];
|
||||
|
||||
if (is_a($exception, \moodle_exception::class)) {
|
||||
|
@ -769,9 +769,11 @@ if (!isset($CFG->debugdisplay)) {
|
||||
// Some parts of Moodle cannot display errors and debug at all.
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('zend.exception_ignore_args', '1');
|
||||
} else if (empty($CFG->debugdisplay)) {
|
||||
ini_set('display_errors', '0');
|
||||
ini_set('log_errors', '1');
|
||||
ini_set('zend.exception_ignore_args', '1');
|
||||
} else {
|
||||
// This is very problematic in XHTML strict mode!
|
||||
ini_set('display_errors', '1');
|
||||
|
@ -425,6 +425,9 @@ abstract class route_testcase extends \advanced_testcase {
|
||||
$payload = $this->decode_response($response);
|
||||
$this->assertObjectHasProperty('message', $payload);
|
||||
$this->assertObjectHasProperty('stacktrace', $payload);
|
||||
foreach ($payload->stacktrace as $frame) {
|
||||
$this->assertObjectNotHasProperty('args', $frame);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user