panel icon indicating copy to clipboard operation
panel copied to clipboard

Boolean in variables can only be 1 or 0 and not longer TRUE or FALSE

Open gOOvER opened this issue 2 years ago • 5 comments

Current Behavior

When you use in variables: required|boolean and as Value TRUE or FALSE, it will be everytime overwritten to 0 or 1. It's not langer possible to use TRUE or FALSE.

Looks like, this merged PR is the problem: https://github.com/pterodactyl/panel/commit/7d0d71baec8ccaeba5e9d63de203564d39d731b4

Expected Behavior

The field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".

see: https://laravel.com/docs/8.x/validation#rule-boolean

Steps to Reproduce

  • create a variable with requiered|boolean
  • add value true
  • try to save with value TRUE (or false)

Panel Version

1.7.0

Wings Version

1.6.1

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

  • [X] I have searched the existing issues before opening this issue.
  • [X] I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • [X] I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.

gOOvER avatar May 26 '22 05:05 gOOvER

Is your issue just that they store as 1/0, or is there something receiving 1/0 in place of a boolean value?

DaneEveritt avatar May 26 '22 12:05 DaneEveritt

True and false are considered invalid in the admin area if you want to save the values. You can only use 1 and 0.

In the user area, true and false are overwritten by 0 and 1 as soon as you use the switch. (In the admin area it becomes a 0 and 1, although the default value is false or true).

gOOvER avatar May 26 '22 13:05 gOOvER

This problem isn't caused by my PR because it didn't touch the admin area. The problem is that the input field in the admin area converts the true/ false into a string. And a true/ false as string isn't accepted for a boolean.

Boy132 avatar May 26 '22 13:05 Boy132

please fix @matthewpi

HerrSammyDE avatar Jul 20 '23 18:07 HerrSammyDE

A workaround: string|in:true,false and it will show as a switch

tnqzh123 avatar Jan 31 '24 12:01 tnqzh123