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.
Top comments (2)
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?
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