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
/printthread.php 16 require_once



UserSpice
Possible bug: Ignoring zero's at the end of form fields - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Possible bug: Ignoring zero's at the end of form fields (/showthread.php?tid=910)



Possible bug: Ignoring zero's at the end of form fields - kaaregb - 01-11-2018

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 :-)


Possible bug: Ignoring zero's at the end of form fields - Brandin - 01-11-2018

This would be something to do with the sanitizing class...@mudmin thoughts?


Possible bug: Ignoring zero's at the end of form fields - mudmin - 01-11-2018

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?



Possible bug: Ignoring zero's at the end of form fields - mudmin - 01-11-2018

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!



Possible bug: Ignoring zero's at the end of form fields - mudmin - 01-11-2018

It seems to save for me. Let me check with Brandin on discord.



Possible bug: Ignoring zero's at the end of form fields - Brandin - 01-11-2018

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?


Possible bug: Ignoring zero's at the end of form fields - kaaregb - 01-12-2018

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.


Possible bug: Ignoring zero's at the end of form fields - Brandin - 01-12-2018

This is great information @kaaregb! Thanks for this!