| @@ -76,9 +76,9 @@ | ||
| 76 | 76 | // Check required fields |
| 77 | 77 | if (isset($schema['required'])) { |
| 78 | 78 | foreach ($schema['required'] as $required_field) { |
| 79 | 79 | if (!isset($params[$required_field])) { |
| 80 | - throw new InvalidArgumentException("Missing required parameter: {$required_field}"); | |
| 80 | + throw new InvalidArgumentException("Missing required parameter: {$required_field}"); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| @@ -92,24 +92,24 @@ | ||
| 92 | 92 | $value = $params[$field]; |
| 93 | 93 | $expected_type = isset($field_schema['type']) ? $field_schema['type'] : null; |
| 94 | 94 | |
| 95 | 95 | if ($expected_type && !$this->validate_type($value, $expected_type)) { |
| 96 | - throw new InvalidArgumentException("Invalid type for parameter '{$field}': expected {$expected_type}"); | |
| 96 | + throw new InvalidArgumentException("Invalid type for parameter '{$field}': expected {$expected_type}"); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Validate enum |
| 100 | 100 | if (isset($field_schema['enum']) && !in_array($value, $field_schema['enum'], true)) { |
| 101 | 101 | $allowed = implode(', ', $field_schema['enum']); |
| 102 | - throw new InvalidArgumentException("Invalid value for parameter '{$field}': must be one of [{$allowed}]"); | |
| 102 | + throw new InvalidArgumentException("Invalid value for parameter '{$field}': must be one of [{$allowed}]"); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Validate min/max for integers |
| 106 | 106 | if ($expected_type === 'integer') { |
| 107 | 107 | if (isset($field_schema['minimum']) && $value < $field_schema['minimum']) { |
| 108 | - throw new InvalidArgumentException("Parameter '{$field}' must be >= {$field_schema['minimum']}"); | |
| 108 | + throw new InvalidArgumentException("Parameter '{$field}' must be >= {$field_schema['minimum']}"); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 109 | 109 | } |
| 110 | 110 | if (isset($field_schema['maximum']) && $value > $field_schema['maximum']) { |
| 111 | - throw new InvalidArgumentException("Parameter '{$field}' must be <= {$field_schema['maximum']}"); | |
| 111 | + throw new InvalidArgumentException("Parameter '{$field}' must be <= {$field_schema['maximum']}"); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
| @@ -292,7 +292,7 @@ | ||
| 292 | 292 | * @return array |
| 293 | 293 | * @throws Exception |
| 294 | 294 | */ |
| 295 | 295 | protected function error($message, $code = 'error') { |
| 296 | - throw new Exception($message); | |
| 296 | + throw new Exception($message); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- JSON-RPC error payload, JSON-encoded on output, never rendered as HTML; escaping here would corrupt message bytes | |
| 297 | 297 | } |
| 298 | 298 | } |