September 2009
4 posts
1 tag
PHP htmlspecialchars()/htmlentities() invalid...
Here’s a seemingly nonsensical gotcha I just discovered with error handling for htmlspecialchars() and htmlentities() in PHP. Since PHP 5.2.5, if either of those functions are passed invalid multibyte strings (invalid UTF-8, perhaps containing a truncated multi-byte character after improper use of substr() intead of mb_substr()) then PHP triggers the following error and returns an empty...
1 tag
Design by Contract - for efficient coding
Yesterday I picked up this tweet from Joel:
Getting into PHP Exceptions. Very useful :) Example - userExists() function should raise exception when no user passed, not return false!
Hang on, should it? While exceptions in programming languages are without doubt a useful tool, his example reminded me of a problematic style of coding I’ve experienced - something I consider an...
2 tags
Reliability Bug in Facebook PHP API Batching...
I recently discovered a bug in the current Facebook API PHP Client library that affects the support for batching calls which I’ve used for the Selective Twitter Status application.
The bottom line is, sometimes the call to batch.run within execute_server_side_batch() as called by end_batch() returns an empty string instead of the expected array of results from each of the batched calls....
1 tag
If you can't find yourself in Twitter Search..
I just came across a recent help page from Twitter (from June) about what to do if your tweets are not showing up in the twitter search. As it already says on the Selective Twitter Status help page, your tweets not showing in Twitter search is one of the most common reasons for the app not working for you, particularly if it used to work but suddenly stopped.
To check if your tweets are coming...