June 21, 2013

PHP ['SCRIPT_NAME'] returning empty string

I was working with Slim (v2.2.x) the other day and saw that a PHP warning was being thrown in one of the interal Slim files: Warning: strpos(): Empty needle in /vendor/slim/slim/Slim/Environment.php on line 143 The code throwing the warning was the following if statement: if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) { The actual issue was that $_SERVER['SCRIPT_NAME'] was an empty string, so strpos was complaining as that is invalid syntax. ... Read more

May 9, 2013

iOS 6 caching POST requests

Apparently I’ve been living under a rock, never having been bitten (that I know of) by the pretty massive bug Apple rolled out in iOS 6 (with Safari). The bug has been well documented around the interwebs, basically Safari caches HTTP POST requests. If you haven’t heard about this…stop and read that last bit again. Now, replicating this bug is dependent on the payload of the POST not changing between requests, so in many circumstances you may be fine. ... Read more

© Michael Sharman 2017