Thursday, March 25th, 2010
It’s the end of an era for IE6 at Milestone Search

Recently we’ve restructured much of the way our website is formed at Milestone Search. What we’ve basically done is separated all of our core businesses into their own departments and provided 1 exclusive web site for each offering.
If you have experienced any problems accessing our site over the last 2 weeks then I need to ask you what on earth you’re doing awake at such a strange hour in the morning? Typically I’ve been writing and rewriting the site and it’s structure (content excluded) some time after 10PM and usually finishing around 4:00AM in the morning. In truth, it has not done wonders for my marriage and frankly, as I write this, the screen seems to be moving around on the bench and I find myself nudging myself just to stay awake every 5 minutes or so.
It’s been a good experience and allowed me to get my hands dirty again on writing some code. Obviously, PHP is not exactly the most complex language but unlike my previous experience programming, when you get it wrong, there is no debugger to let you know why. The number of times I pressed reload on the browser to discover that, *argggg*… nothing… Of course, most times one is working with a text editor and this does not allow source control. So, if you can’t work out where your modification went wrong, you either spend hours stepping over code or you revert to some previously saved version. Of course there is google, but, interestingly, I found many of the issues I came across had solutions buried deep in search pages so far from the home page I usually arrived at some point in time far surpassing exasperation! Oh, one quick tip I have to share for people who may be currently experiencing this issue.
PHP – RSS Feed issue….
“If you’re using RSS for PHP and keep getting a random error with feeds then I share you’re pain !
In fact, the primary source code examples provided by PHP and other developers in the know all provided the same source code example (or minor variations) when attempting to get a feed. Be it from facebook, twitter, or some other server. This is a basic example of what they consider best practice :
$rss = fetch_feed($url);
foreach ($rss->get_items() as $item) {
Now I checked and double checked my code. No problems. Then I started my google search attempting to find the solution to the problem. After all, it’s not nice when you load a web page and are presented with an error. Sure, there was lot’s of help out there from users who wanted to be helpful but their help is a bit like a 3 year old wanting to help Michaelangelo paint the Sistine Chapel Ceiling. Of course, I in no capacity see my programming skills up to the standard of Michaelangelo, but by comparison, at least I’ve got a ladder. They advice they offered varied from extremes such as reinstalling apache right through to restructuring the code. Most code mods were really just a syntax change and same annoying error continued to rear its ugly head! At certain times during the night I even considered the possibility that throwing the computer out the window may well in fact help ! Possibly, with some minute chance, it could, maybe help resolve the problem. Then, each time, just as I thought I’d fixed it by making some minor .INI change or modifying some SQL Server setting it would appear again. Like some childhood taunt that you just cant escape from. Another sigh, another several hours on google searching for the answer but each time I was brought back to the above example as what is considered the tried and tested way to get a feed.
The error, which I didnt even need to search to place here, because it’s words are burned into my mind is, “Warning: Invalid argument supplied for foreach()” …
In hindsight, it’s actually quite obvious, but on another level, I’ve not coded in PHP before so I feel I could be forgiven for overlooking such an obvious reason as to why this was happening.
Now if you’ve stumbled upon this page through google, let me share with you the simple answer for this rather annoying problem. The answer that drove me to the edge of madness in pursuit for it’s resolution. Put simply, by using the foreach command PHP assumes you have an array. As such, it attempts to break the array apart regardless of what’s in it. So, for example, if the server you were pinging was down, the array is empty. But PHP does not know this and as a result crashes when attempting to call the first item in the array. So, the fix? Simple.
$rss = fetch_feed($url);
< — Right here place the following before the foreach command ” if ($rss){ ”
foreach ($rss->get_items() as $item) {
and at the end of the cycle place your closed bracket thingy.. }
This way, if the stream is dead or the server you are pinging is down, PHP wont attempt to execute the foreach loop. Rather it’ll just jump to the next part of your code.
Now with all the above said, I realise I have digressed from the original point of this post. That point was to let you know that we will no longer be providing support for IE6 on most of our domains moving forward. Over the next couple of weeks, we will be systematically locking out each server one by one. Now when I say no longer providing support, I don’t mean that you will be able to access our content but your browser wont be supported, what I mean to say is that you wont be able to access our content with IE6 at all. A little like the situation I found myself in several months ago when I came home from work a little late after a stop in at the pub with some old friends. No key, no access, locked out in the freezing cold ! Why? Well, other than the obvious reasons relating to the significant security flaws with IE6, the header issues and the fact that it is slow and just basically a badly written piece of software, to support IE6 one needs to almost write a second set of CSS classes and almost a totally second web site just to cope with all the errors that IE6 brings to the table in relation to its formatting. So, given that IE6 users now constitutes less than 20 percent of the entire browser population, we’ve simply decided that from a business perspective, it’s more finally viable to lock out users who are still using this badly written piece of software rather than rewriting and modifying all our sites to cope with the annoyances of Microsofts browser… Of course, when I use the word annoyances, I it with clenched teeth that only one who has attempted to develop a website can share. Besides, if you want more good reasons why IE6 should be wiped off the face of the planet all together, just go to google and search for “why ie6 must die”. Of course, given that google have their own browser, one could argue that they have interest in this cause, but that’s not to say that the arguments against IE6 are any less valid.
So, moving forward, any user who is still on the IE6 platform that attempts to access our site will be presented with a window offering a link to google chrome (a FREE and totally superior browser), OR, NOTHING. Of course I say that with a grin on my face as someone who has suffered at the mercy of the big Microsoft browser bugs. As for people who throw around the argument, “what about businesses that still use IE6.” Well, all I want to point out is that most business who use IE6 are doing so against the advice of the IT guys and secondly, a free upgrade for “valid” Microsoft users has existed for several years now. Rolling out an upgrade is simple and there is no reason a business shouldn’t… Unless of course they are not validated users…
So, if you have IE6 and use any of Milestone Search’s web services, please note that within the coming days and weeks, probably at some strange time between 3 or 4 in the morning, each domain will modified with a simple header script that will be used to lock out IE6 browsers all together.
If that’s you, please don’t get all upset, get Google chrome instead… http://www.google.com/chrome
David Sparrius.
Tags: code, Feed, foreach, google, minor variations, PHP, source code examples, strange hour
| View all IT Jobs | View other IT opportunities | Milestone IT is a specialist in IT Contracting | Seeking another IT contract or IT Employment | View our latest news on IT recruitment |
