<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jamie Thompson &#187; Bug</title>
	<atom:link href="http://jamiethompson.co.uk/tags/bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamiethompson.co.uk</link>
	<description>Web Developer</description>
	<lastBuildDate>Tue, 08 May 2012 10:58:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pages Redirecting to a 404 Error Only in Internet Explorer</title>
		<link>http://jamiethompson.co.uk/web/2008/09/23/pages-redirecting-to-a-404-error-only-in-internet-explorer/</link>
		<comments>http://jamiethompson.co.uk/web/2008/09/23/pages-redirecting-to-a-404-error-only-in-internet-explorer/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 13:00:15 +0000</pubDate>
		<dc:creator>Jamie Thompson</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[wtf]]></category>

		<guid isPermaLink="false">http://jamazon.co.uk/?p=150</guid>
		<description><![CDATA[
This one had me stumped. The control panel for our CMS worked fine, just as it had been since, well since forever. The problem was that when visited with Internet Explorer users were now being presented with a brief flash of the login page followed by a 404 Not Found error.
After repeatedly pummeling my desk [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://s322999261.websitehome.co.uk/wp-content/uploads/2008/09/ie404-1.jpg" alt="" title="404 Error Occuring only in Internet Explorer" width="530" height="190" /></p>
<p>This one had me stumped. The control panel for our CMS worked fine, just as it had been since, well since forever. The problem was that when visited with Internet Explorer users were now being presented with a brief flash of the login page followed by a 404 Not Found error.</p>
<p>After repeatedly pummeling my desk with my head I noticed that turning off Internet Explorer&#8217;s  friendly HTTP errors allowed the control panel to be viewed as expected. So why was Internet Explorer in particular interpreting the server&#8217;s response as a 404 when it was clearly a 200? I already knew that the server wasn&#8217;t issuing a 404 response and the Live HTTP headers Firefox plugin confirmed this.</p>
<p>The HTTP headers displayed by <a href="http://www.blunck.se/iehttpheaders/download.html">ieHTTPHeaders</a> (Thanks for the tip <a href="http://www.lyalloldfield.co.uk">Lyallzord</a>) told a different story though.</p>
<p><img src="http://s322999261.websitehome.co.uk/wp-content/uploads/2008/09/ie404-2.jpg" alt="" title="Incorrectly referenced IE behaviour causing a 404 Not Found Error" width="530" height="212" /></p>
<p>The problem was eventually traced to an incorrectly referenced pngfix behaviour pngbehaviour.htc in one of the control panel stylesheets. To be honest it was news to me that it even existed, but the path was incorrect following a restructuring of site assets hence the broken reference.</p>
<p>It seems that Internet Explorer on recieving a 404 response for referenced behaviour will helpfully 404 the entire document.</p>
<p>So that&#8217;s nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiethompson.co.uk/web/2008/09/23/pages-redirecting-to-a-404-error-only-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>An IE7 Bug That Returns MSIE 6.0 User Agent String</title>
		<link>http://jamiethompson.co.uk/web/2008/07/23/an-ie7-bug-that-returns-msie-60-user-agent-string/</link>
		<comments>http://jamiethompson.co.uk/web/2008/07/23/an-ie7-bug-that-returns-msie-60-user-agent-string/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 13:44:15 +0000</pubDate>
		<dc:creator>Jamie Thompson</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[ie7]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://jamazon.co.uk/?p=99</guid>
		<description><![CDATA[
IE7, don&#8217;t you just love it? What they gave us with one had in terms of CSS actually sort of working they took away with some of the stupidest niggly little bugs ever. Here&#8217;s another potentially large one i&#8217;m stumbled right into recently.
If your user agent string is more than 260 characters in length then [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://s322999261.websitehome.co.uk/wp-content/uploads/2008/07/header.jpg" alt="Internet Explorer 7 User Agent Bug (MSIE 6.0)" title="Internet Explorer 7 User Agent Bug (MSIE 6.0)" width="530" height="190" /></p>
<p>IE7, don&#8217;t you just love it? What they gave us with one had in terms of CSS actually sort of working they took away with some of the stupidest niggly little bugs ever. Here&#8217;s another potentially large one i&#8217;m stumbled right into recently.</p>
<p><strong>If your user agent string is more than 260 characters in length then your user agent string suddenly and almost magically becomes &#8220;Mozilla/4.0 (compatible; MSIE 6.0)&#8221;</strong></p>
<p>Not what you&#8217;d expect to happen. Now, I know what your thinking. Why on god&#8217;s earth would your user agent string BE that long. The answer is simple. Toolbars and Spyware.</p>
<p><span id="more-99"></span></p>
<h2>Toolbars and Spyware</h2>
<p>The <em>cool</em> thing about Windows is that toolbars, spyware and crapware in general can and do add pointless shit to your Internet Explorer user agent string via the registry. Sounds good doesn&#8217;t it. Now consider the following:</p>
<ol>
<li>Most store bough Windows PCs come pre-installed with tons of stupid toolbars and crapware</li>
<li>IE 7 isn&#8217;t much more secure than IE6 was in terms of spyware</li>
<li>Home users do not know or care about viruses and spyware</li>
</ol>
<p>With me?</p>
<h2>Try it yourself</h2>
<p>You can easily trigger this bug yourself by editing the registry. Fire up regedit and navigate to HKLM/Software/Microsoft/Windows/CurrentVersion/Internet Settings/5./0User Agent/Post Platform. Create a new string key and fill up full of crap (enough to pass the 260 character threshold)</p>
<p><img src="http://s322999261.websitehome.co.uk/wp-content/uploads/2008/07/regedit.jpg" alt="regedit" title="regedit" width="530" height="190" /></p>
<p>Next, close all instances of IE. Fire UP IE again and type the following into the address bar:</p>
<pre class="brush: js">javascript:alert(navigator.userAgent)</pre>
<p>Hit enter and IE7 should now tell you that it&#8217;s IE6. Awesome!</p>
<p>I firmly believe that this is one of the reasons behind problems such as the <a href="/web/2008/03/17/thickbox-31-ie7-positioning-bug/">thickbox positioning bug </a>that many people experience with IE7.</p>
<h2>The workaround?</h2>
<p>This is of course just another argument against relying on the user agent string to determine browser version. It really shouldn&#8217;t be done this way, yet it&#8217;s the method built into many JavaScript libraries including jQuery with it&#8217;s <a href="/web/2008/03/14/jquerybrowserversion-doesnt-recognise-ie7/">unreliable $.browser.version</a> property.</p>
<p>If you really need to know if a browser is IE6 or IE7 then use something more solid like object detection. Simply testing for something like the following would be a better option than extracting unreliable data from the user agent string</p>
<p>A possible patch below redefines the browser version as &#8220;7.0&#8243; only if the browser has already been identified as IE6 and the the presence of the XMLHttpRequest object suggests otherwise.</p>
<pre class="brush: js">if(jQuery.browser.msie &#038;&#038; parseInt(jQuery.browser.version) == 6 &#038;&#038; this.XMLHttpRequest) {
	jQuery.browser.version = "7.0"
}</pre>
<p>I&#8217;m thinking though that maybe this might not be bulletproof. If IE8 presents the same or similar &#8220;Hi i&#8217;m IE6!&#8221; behaviour then the above patch could incorrectly identify IE8 as IE7. This might not be as serious as IE7 vs. IE6 but it&#8217;s still an issue.</p>
<p>I just wish that Microsoft would put a bit more effort into writing good software. It&#8217;s not like they don&#8217;t have the resources.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiethompson.co.uk/web/2008/07/23/an-ie7-bug-that-returns-msie-60-user-agent-string/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>imagettfbbox() Could not find/open font</title>
		<link>http://jamiethompson.co.uk/web/2008/06/04/imagettfbbox-could-not-findopen-font/</link>
		<comments>http://jamiethompson.co.uk/web/2008/06/04/imagettfbbox-could-not-findopen-font/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 23:51:41 +0000</pubDate>
		<dc:creator>Jamie Thompson</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://jamazon.co.uk/?p=76</guid>
		<description><![CDATA[This evening I noticed a problem with the script which generates the image headings for this site. It had stopped working. I hadn&#8217;t noticed until now because the process caches all previously generated images and as such it hadn&#8217;t actually run for a while.
The error
imagettfbbox() [function.imagettfbbox]: Could not find/open font
The specified font file existed and [...]]]></description>
			<content:encoded><![CDATA[<p>This evening I noticed a problem with the script which generates the image headings for this site. It had stopped working. I hadn&#8217;t noticed until now because the process caches all previously generated images and as such it hadn&#8217;t actually run for a while.</p>
<h2>The error</h2>
<p><strong>imagettfbbox() [function.imagettfbbox]: Could not find/open font</strong></p>
<p>The specified font file existed and was readable. I was in fact testing for this eventuality using is_readable() prior to the the imagettfbbox call. After some poking around and a bit of googling I narrowed the problem down to a bug.. or feature in PHP > 4.3.0</p>
<h2>The solution</h2>
<p>It&#8217;s a simple fix, but what worked for me was to pass imagettfbbox an absolute path to the font. This is with PHP 5.2.0. I&#8217;ve read of this working for lots of people using various versions of PHP from 4.3.0 onwards, but it also seems that this isn&#8217;t always the solution, so your mileage may vary. As usual, it probably depends on a magic combination of seven million random compile flags.</p>
<p>So to sum up. Using imagettfbbox with relative font paths in PHP >= 4.3.0 may result in an error. A solution seems to be to use absolute paths. If this isn&#8217;t the issue, it could be spaces in the filename? Your really shouldn&#8217;t put spaces in filenames, what are you a windows user?</p>
<p>Official bug report here: <a href="http://bugs.php.net/bug.php?id=22092">http://bugs.php.net/bug.php?id=22092</a></p>
<p><em>Sometimes* PHP just sucks</em></p>
<p>* all the time</p>
]]></content:encoded>
			<wfw:commentRss>http://jamiethompson.co.uk/web/2008/06/04/imagettfbbox-could-not-findopen-font/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

