SiteCrafting Blah Blah Blog

Oct. 11, 2006 at 7:29pm

The Three 'M'-igos

Why butter fingers break apps

Happens all the time, right? One minute you're cranking out line after line of quality code then the next it all comes to a screeching halt for no apparent reason. I immediately go into troubleshooting mode. A quick and simple redirect using a header("Location: ...") function should pose no danger of messing up my app -- but today it did.
It kept throwing me to a "Page Not Found" message and, since it was technically only moving me to the exact same script, I couldn't see why. For such a simple line of code to push things so far out of whack seemed preposterous. Well, it's always good to check your digital ego at the door and go through it all rationally.

Here's how I thought this out:

  • the redirect tossed me to the same script yet gave me a "Page Not Found"
  • any GET variables I passed were fine and weren't even being relied upon heavily
  • the server was running fine since the previous and other pages were displaying just fine
  • I was redirecting to the correct URL -- wait a minute!

Turns out I wasn't at all. I was routing the script from comments.php to commments.php and that just ain't right. I suppose when you have so many of the same characters in a row the brain tends to skip over them once in a while. Whatever the reason, it took me a few minutes to catch and I just had to chalk it up to another hard lesson learned since I neglected to believe in Occam's Razor. Next time, I'll check to see if it's spelled correctly first.

Posted in Coding Techniques, PHP by Kevin Freitas

Comments (3)

Dave says:

Yep. I did the same thing today, except with SSS insead of SS in $_SESSION
1 | Oct. 12, 2006 at 1:58pm


My favorite hard-to-spot error is a variant on the ever popular = vs. == mixup ... except I believe most people tend to assign where they meant to evaluate, and I keep evaluating instead of assigning. This can be very confusing.

But for what it's worth, I had to read that about two and a half times before I realized what you were pointing out. So it's not just you. ; )
2 | Left by Relsqui | Oct. 25, 2006 at 3:40am


Kevin says:

Hehe, true dat. I've had occasion to spend time troubleshooting something that's the result of assigning rather than evaluating. I'm sure we've all been there.
3 | Oct. 25, 2006 at 10:38pm


Remember me
Name: Email: URL: Comment: *   No HTML, http:// will auto-link
* required    Comment Guidelines