Skip to content

Commit

Permalink
Escape var values in exception messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jan 23, 2024
1 parent bd41f01 commit 4c48587
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/AbstractPaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public function set_country_code( $country_code ) {
throw new InvalidArgumentException(
sprintf(
'Given country code `%s` not ISO 3166-1 alpha-2 value.',
$country_code
\esc_html( $country_code )
)
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct( $country, $street = null, $house_number_or_name = n
throw new InvalidArgumentException(
sprintf(
'Given country `%s` not ISO 3166-1 alpha-2 value.',
$country
\esc_html( $country )
)
);
}
Expand Down Expand Up @@ -124,8 +124,8 @@ public function __construct( $country, $street = null, $house_number_or_name = n
throw new InvalidArgumentException(
sprintf(
'Given postal code `%s` is longer then `%d` digits.',
$postal_code,
$max
\esc_html( $postal_code ),
\esc_html( $max )

Check failure on line 128 in src/Address.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan

Parameter #1 $text of function esc_html expects string, int given.
)
);
}
Expand Down Expand Up @@ -164,8 +164,8 @@ public function __construct( $country, $street = null, $house_number_or_name = n
throw new InvalidArgumentException(
sprintf(
'Given state or province `%s` is longer then `%d` digits.',
$state_or_province,
$max
\esc_html( $state_or_province ),
\esc_html( $max )

Check failure on line 168 in src/Address.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan

Parameter #1 $text of function esc_html expects string, int given.
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct( $currency, $value ) {
throw new \InvalidArgumentException(
sprintf(
'Given currency `%s` not a three-character ISO currency code.',
$currency
\esc_html( $currency )
)
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ private function send_request( $method, $request ) {
throw new \Exception(
\sprintf(
'Could not JSON decode Adyen response to an object, HTTP response: "%s", HTTP body: "%s".',
$response->status(),
$response->body()
\esc_html( $response->status() ),

Check failure on line 76 in src/Client.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan

Parameter #1 $text of function esc_html expects string, int|string given.
\esc_html( $response->body() )
),
\intval( $response->status() )
);
Expand Down
2 changes: 1 addition & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function start( Payment $payment ) {
throw new \Exception(
\sprintf(
'The handling of the `%s` result code is not implemented.',
$result_code
\esc_html( $result_code )

Check failure on line 247 in src/Gateway.php

View workflow job for this annotation

GitHub Actions / phpstan / phpstan

Parameter #1 $text of function esc_html expects string, string|null given.
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function set_infix( $infix ) {
throw new InvalidArgumentException(
sprintf(
'Given infix `%s` is longer then 20 characters.',
$infix
\esc_html( $infix )
)
);
}
Expand Down

0 comments on commit 4c48587

Please sign in to comment.