Skip to content

Commit a1102e5

Browse files
committed
Type check
1 parent 36cf65f commit a1102e5

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/MCP/Abilities/AbilityRuntime.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ public function execute( ToolInterface $tool, array $args ) {
107107
return $error;
108108
}
109109

110+
if ( ! $response instanceof \WP_REST_Response ) {
111+
$error = $this->error( 'rest_dispatch_error', 'Invalid REST response.', 500 );
112+
$this->record_error( $entry, 'error', $error );
113+
return $error;
114+
}
115+
110116
$status = (int) $response->get_status();
111117
$data = $response->get_data();
112118
$result = is_array( $data ) ? $data : [ 'result' => $data ];

src/MCP/Audit/WpdbAuditDatabase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function get_results( string $query, $output = null ) {
8181
return $rows;
8282
}
8383

84-
if ( $output !== ARRAY_A ) {
84+
if ( ! defined( 'ARRAY_A' ) || $output !== ARRAY_A ) {
8585
/** @phpstan-ignore-next-line Return type varies by $output format (OBJECT returns array<stdClass>, etc.) */
8686
return $rows;
8787
}

0 commit comments

Comments
 (0)