MikeRandrup

pet projects in code, graphics, and more.

By

It was the extra “space” that killed it.

Just finished troubleshooting a bug in a customer system. It’s a piece of custom software, run from a website, and written in PHP. This software collects orders from customers online, and transfers them into QuickBooks via a custom XML service and the QuickBooks Web Connector. And the other day, after a simple update, it stopped working.

Guess what the problem was? Heinous code changes? Chinese hackers? Faulty QuickBooks update? Nope. It was a single ” ” (space) character.

Several functions of the system require that absolutely no output be sent to the browser screen for various redirect functions, especially surrounding SSL and initiating a SOAP session with QuickBooks. Well, the extra character had been accidentally typed into the visible part of a PHP script file filled with common functions.

I finally found what the problem was after pulling the backup version of the recently changed file out of our Amazon S3 cloud backups (performed via JungleDisk automatically on our affected server at The Planet). Restoring the old version of the file fixed the problem, so I used Komodo code editor to compare the files (results attached).

It turned out that there was an extra ” ” (space) at the end of the file that got sent to the screen too early. And the browser got really confused about the content of the page as a result.

Just more evidence of the complex nature of these systems that make the web go round. Good thing we have solid processes for tracking and fixing! Yay for automatic backups into the cloud.