<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16904] trunk: Fix fatal error on IIS after r16797.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16904">16904</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2010-12-14 08:31:33 +0000 (Tue, 14 Dec 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix fatal error on IIS after r16797. props peaceablewhale. Limit variable string searching when possible. See <a href="http://trac.wordpress.org/ticket/10187">#10187</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmiscphp">trunk/wp-admin/includes/misc.php</a></li>
<li><a href="#trunkwpincludescanonicalphp">trunk/wp-includes/canonical.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmiscphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/misc.php (16903 => 16904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/misc.php        2010-12-13 22:38:27 UTC (rev 16903)
+++ trunk/wp-admin/includes/misc.php        2010-12-14 08:31:33 UTC (rev 16904)
</span><span class="lines">@@ -379,34 +379,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Check if IIS 7 supports pretty permalinks
- *
- * @since 2.8.0
- *
- * @return bool
- */
-function iis7_supports_permalinks() {
-        global $is_iis7;
-
-        $supports_permalinks = false;
-        if ( $is_iis7 ) {
-                /* First we check if the DOMDocument class exists. If it does not exist,
-                 * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
-                 * hence we just bail out and tell user that pretty permalinks cannot be used.
-                 * This is not a big issue because PHP 4.X is going to be depricated and for IIS it
-                 * is recommended to use PHP 5.X NTS.
-                 * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
-                 * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
-                 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
-                 * via ISAPI then pretty permalinks will not work.
-                 */
-                $supports_permalinks = class_exists('DOMDocument') &amp;&amp; isset($_SERVER['IIS_UrlRewriteModule']) &amp;&amp; ( php_sapi_name() == 'cgi-fcgi' );
-        }
-
-        return apply_filters('iis7_supports_permalinks', $supports_permalinks);
-}
-
-/**
</del><span class="cx">  * Check if rewrite rule for WordPress already exists in the IIS 7 configuration file
</span><span class="cx">  *
</span><span class="cx">  * @since 2.8.0
</span></span></pre></div>
<a id="trunkwpincludescanonicalphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/canonical.php (16903 => 16904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/canonical.php        2010-12-13 22:38:27 UTC (rev 16903)
+++ trunk/wp-includes/canonical.php        2010-12-14 08:31:33 UTC (rev 16904)
</span><span class="lines">@@ -35,9 +35,9 @@
</span><span class="cx">  *                not needed or the string of the URL
</span><span class="cx">  */
</span><span class="cx"> function redirect_canonical( $requested_url = null, $do_redirect = true ) {
</span><del>-        global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
</del><ins>+        global $wp_rewrite, $is_iis7, $wp_query, $wpdb;
</ins><span class="cx"> 
</span><del>-        if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_IIS &amp;&amp; !iis7_supports_permalinks() ) )
</del><ins>+        if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || !empty($_POST) || is_preview() || is_robots() || ( $is_iis7 &amp;&amp; !iis7_supports_permalinks() ) )
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><span class="cx">         if ( !$requested_url ) {
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (16903 => 16904)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2010-12-13 22:38:27 UTC (rev 16903)
+++ trunk/wp-includes/functions.php        2010-12-14 08:31:33 UTC (rev 16904)
</span><span class="lines">@@ -3422,6 +3422,34 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * Check if IIS 7 supports pretty permalinks
+ *
+ * @since 2.8.0
+ *
+ * @return bool
+ */
+function iis7_supports_permalinks() {
+        global $is_iis7;
+
+        $supports_permalinks = false;
+        if ( $is_iis7 ) {
+                /* First we check if the DOMDocument class exists. If it does not exist,
+                 * which is the case for PHP 4.X, then we cannot easily update the xml configuration file,
+                 * hence we just bail out and tell user that pretty permalinks cannot be used.
+                 * This is not a big issue because PHP 4.X is going to be depricated and for IIS it
+                 * is recommended to use PHP 5.X NTS.
+                 * Next we check if the URL Rewrite Module 1.1 is loaded and enabled for the web site. When
+                 * URL Rewrite 1.1 is loaded it always sets a server variable called 'IIS_UrlRewriteModule'.
+                 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
+                 * via ISAPI then pretty permalinks will not work.
+                 */
+                $supports_permalinks = class_exists('DOMDocument') &amp;&amp; isset($_SERVER['IIS_UrlRewriteModule']) &amp;&amp; ( php_sapi_name() == 'cgi-fcgi' );
+        }
+
+        return apply_filters('iis7_supports_permalinks', $supports_permalinks);
+}
+
+/**
</ins><span class="cx">  * File validates against allowed set of defined rules.
</span><span class="cx">  *
</span><span class="cx">  * A return value of '1' means that the $file contains either '..' or './'. A
</span></span></pre>
</div>
</div>

</body>
</html>