DEV Community

─ 502 l4p1n ─►
─ 502 l4p1n ─►

Posted on

The spelling bug

I've been coding in the web section for about five years now and I faced many bugs. From silly syntax errors to annoying logic errors, I dealt with them more or less successfully. Two or three years ago, while hacking on some CakePHP 2 because why not, I've made a silly, yet annoying misspell in an array index.

I was testing if my freshly written route was working and I noticed something odd while using it: the route didn't seem to be recognized and the generated URL wasn't quite right.

I spent around half an hour figuring out the wrong bit by throwing some var_dump all over the place to see what's going on until I suddenly decided to have a closer look at my route and compare it to the previous ones. I found the stupid misspelling: an "s" was missing. When I found it, I was happy and quite disappointed at the same time. Happy because the bug was found and disappointed because. Well. That was a silly bug because of not paying attention at what I was writing.

I'm pretty sure you encountered by one way or another a silly bug or a very annoying one. Let me know down in the comments section, I'm curious about what kind of them you got.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (2)

Collapse
 
palle profile image
Palle

Recently programmed a simple server application in C which managed multiple connections using epoll. However, the program could not receive messages from a connected client. After many hours of inspecting what went wrong, I found the bug.

It was in the line while ((new_connection = accept(fd, &new_addr, &len) != -1)).
Can you spot it?

Collapse
 
foxtacles profile image
Christian Semmler

new_connection always becomes true or false, and the value you actually expect to be stored gets lost. You probably meant this:

while ((new_connection = accept(fd, &new_addr, &len)) != -1)

Nasty one :D

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay