The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possible bug: Ignoring zero's at the end of form fields
#1
Hi, I have this problem which I wonder if it could be a bug:

When reading values from a sent form with "Input::get('fieldname')", any zero's ("0") at the end of the field are ignored. To test this, try adding a zero to a "Cron Name" field in the cron manager listing. It looks ok, but when you loade the page again, you see that the zero hasn't been saved to the database.

When using "$_POST['fieldname']" to read the values from a form, it works fine.

Do you see any solution to this problem?

Best regards
Kaare Grytting Bye :-)
  Reply
#2
This would be something to do with the sanitizing class...@mudmin thoughts?
  Reply
#3
That's very weird. Let me do some checking on this.

Can you give me a little bit of info on the column type you're trying to save this info to in the db?
  Reply
#4
Oh. I just realized that it's a standard page.

The fact that @Brandin built this feature makes me think it's probably human error Smile Let me take a look!
  Reply
#5
It seems to save for me. Let me check with Brandin on discord.
  Reply
#6
Always so mean Mudmin Wink I haven't had a chance to look into this. Mudmin, did you test both Inline Edit and New? Which did you notice this bug on @kaaregb?
  Reply
#7
I first found the bug when I was using the input class in my own code. I was using a form input type "number". When I read the value with Input::get('field'), the zero's at the end of the variable were gone. When I tested in a standard form in the system, like Cron Manager, it was the same with ordinary text field. The error is the same both in Inline Edit and in New Forms. When I remove the "trim" part of the Sanitize Function in the class, it works fine.
  Reply
#8
This is great information @kaaregb! Thanks for this!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)