Brick Wall

It's bound to happen every so often... You'll be programming merrily along, and all of a sudden a chunk of code simply refuses to work.

You double check the usual pitfalls... a statement accidentally placed outside a loop, an inadvertent "=" assignment when what you meant to do was an "==" comparision, a mistyped variable name (which you can get away with in PHP4), and any number of other common pitfalls.

Everything looks OK, so you throw in some debugging statements to dump diagnostic bits to STDOUT.

Debugging indicates that everything is working as it should, but the actual code still refuses to cooperate.

You read and reread the documentation, and scour Google to see if anyone else has encountered your problem, and there's... just... nothing.

You take a walk and have a snack, thinking to yourself that you'll clear your head, elevate your blood sugar, and spot the problem instantly the moment you sit down.

No such luck, and you've now killed half an afternoon on this stupid piece of code that should just work.

The worst part is that you know whatever the problem turns out to be is going to be staring you right in the face once you do find it, and it's going to be so trivial that you feel like an idiot for the rest of the day.

Welcome to my Tuesday afternoon wrestling match with PHP Variable variables.


Five Minutes Later...
Sure enough, as soon as I closed the Movable Type window and went back to the code, I tried a single trim() statement in just the right place and everything else magically worked just the way I knew it was supposed to. Stupid.

Syndicate content

Twitter

  • I don't think it gets much better than 'Revolver' on vinyl. 2 years 48 weeks ago
  • Have fun at #drupalcon everybody! I hate to break my 3 year streak, but I should be back next year... 3 years 17 weeks ago
  • Just made my first Drupal 7 module, 'Entity Relationships', official: http://bit.ly/h3xnPK #drupal #entities #module 3 years 18 weeks ago
  • Already set up my first #git sandbox project for #drupal: http://drupal.org/sandbox/usonian/1072422 3 years 19 weeks ago
  • Drupal.org is coming back online - just set up my SSH keys for #git. Huge props to the #drupal git migration team! 3 years 19 weeks ago

Older

Contact

Andy Chase
(978) 297-6402
andychase [at] gmail.com
GPG/PGP Public Key