Skip to content

Commit

Permalink
Another inappropriate absint; don't allow setting negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Apr 23, 2021
1 parent 348f5e8 commit 891efb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/js/jquery.public.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
var newval = 0;
$(target).addClass('removed');
}
// Prevent setting negative values.
if ( 0 > newval ) {
newval = 0;
}
if ( newval > remain && action == 'more' ) {
$( '.mt-response').html("<p>" + mt_ajax_cart.max_limit + "</p>").show(300);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/mt-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function mt_registration_form( $content, $event = false, $view = 'calendar', $ti
$handling_notice = mt_handling_notice();
$ticket_price_label = apply_filters( 'mt_ticket_price_label', $price, $settings['price'], $ticket_handling );
$value = ( is_array( $cart_data ) && isset( $cart_data[ $type ] ) ) ? $cart_data[ $type ] : apply_filters( 'mt_cart_default_value', '0', $type );
$value = ( '' === $value ) ? 0 : absint( $value );
$value = ( '' === $value ) ? 0 : (int) $value;
$order_value = $value;
$attributes = '';
if ( 'checkbox' === $input_type || 'radio' === $input_type ) {
Expand Down

0 comments on commit 891efb3

Please sign in to comment.