this post was submitted on 21 Feb 2025
96 points (97.1% liked)

Programming

19819 readers
400 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
 

The word, used by computer scientists to mean ‘no value,’ has created long-running challenges

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 30 points 2 months ago (3 children)

Who the hell writes if 'null'? If it's a thing, what language would interpret a string like that?

[–] [email protected] 6 points 2 months ago (2 children)
[–] [email protected] 21 points 2 months ago

No it doesn't?

> Boolean(null)
false
> Boolean('null')
true
> null == 'null'
false
[–] [email protected] 0 points 2 months ago (1 children)
[–] [email protected] 13 points 2 months ago (1 children)

Javascript is fun. The video takes a few jabs at ruby and then gives a glimpse into the insanity that is Javascript.

[–] [email protected] 1 points 2 months ago (1 children)
[–] [email protected] 6 points 2 months ago* (last edited 2 months ago)

!![] + !![] == 2

[–] [email protected] 4 points 2 months ago

I'd bet it's less simple input sanitizing and more 2 mistakes made separately because they don't know any better.

  1. The input field converting everything to a string indiscriminately
  2. Because they did 1, converting everything back to the assumed type

If the front end Dev makes the first mistake, null would be sent in the body as "null". Then on the backend, somebody might even be binding the variables correctly, but before hand realizing they have to deal with the market and rather than just have a conversation undoes it in their own code.

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago)

It's fine in PHP, so that catches most server backends.

Ruby as well, it even raises a warning about the string where a bool should be!

Python handles it just fine, as well.

Rust doesn't allow it, depending on the backend framework and server software this might give issues.

The same goes for C# .NET

So depending on how this is handled a C# or Rust backend might cause the name not to be stored, but then I'd expect nothing to be stored... :/