Posts Tagged ‘php’

I’m a 1337 h4X0r

I love open source software. One reason is that it is almost always free of charge. The second reason is that you can offer suggestions and fixes and sometimes the programmer will listen and implement changes.

I have started using a Wordpress plug-in called All in one Adsense and YPN. It allows me to add advertising to my blog entries without having to mess with the theme. The plug-in worked well except one important feature did not work. It was the feature that allows you to insert code before and after the advertisement. This was important to me because I was unable to style the ads like I wanted unless this feature worked.

The problem was that when you entered the before and after HTML, the plug-in inserted backslashes into my code before each quote mark. This results from a "feature" of PHP 4 and 5 that automatically escapes quote marks. This is to prevent newbies from writing easily exploitable code. The "feature" was removed in PHP 6 and I suspect that the author is using PHP 6 for development because he never could reproduce the bug in his plug-in (If it is the case that he is using PHP 6 for development, he should be smacked a few times. PHP 6 is still in development itself and most servers still run PHP 4 and only a few have even upgraded to PHP 5. He should test on PHP 4 to make sure he has maximum compatibility or just state that his program is PHP 6 only).

Anyway, the problem was easy to fix. PHP provides a function called stripslashes() that essentially stops the automatic escaping of quotes. I added the function in the appropriate places, tested the fix, upped the changes to my own server, posted a message about the fix to the developer’s forum (check my post under the nickname deadgoon), emailed the developer to let him know of the fix, and sat back and waited. I also suggested that he make the 3px of margin around the ad an option instead of a fixed feature so that those who wanted to do their own styling could.

Two days later I received an email thanking me for the fix. One day later — today — I saw that the developer had released a new version. In it was my fix and my suggestion was also implemented. I was given no credit, but you my loyal readers know the real story.

The moral of the story is, don’t just whine about it. Fix it!