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

Programming

21672 readers
154 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 !webdev@programming.dev



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
[–] remotelove@lemmy.ca 30 points 5 months ago (3 children)

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

[–] SpaceNoodle@lemmy.world 6 points 5 months ago (2 children)
[–] kamiheku@sopuli.xyz 21 points 5 months ago

No it doesn't?

> Boolean(null)
false
> Boolean('null')
true
> null == 'null'
false
[–] sir_pronoun@lemmy.world 0 points 5 months ago (1 children)
[–] GoodEye8@lemm.ee 13 points 5 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.

[–] Lemjukes@lemm.ee 1 points 5 months ago (1 children)
[–] dneaves@lemmy.world 6 points 5 months ago* (last edited 5 months ago)

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

[–] ursakhiin@beehaw.org 4 points 5 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.

[–] lord_ryvan@ttrpg.network 1 points 4 months ago* (last edited 4 months 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... :/