Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#22920 closed defect (bug) (fixed)

PHP being included in generated Multisite web.config file

Reported by: stevegrunwell's profile stevegrunwell Owned by: markjaquith's profile markjaquith
Milestone: 3.5.1 Priority: normal
Severity: major Version: 3.5
Component: Multisite Keywords: needs-patch
Focuses: Cc:


When enabling a Multisite network on a subdirectory installation of 3.5 this morning on a Windows server (Windows Server 2008r2, IIS 7, PHP 5.3.18, MySQL 5.1) the web.config file it generated on the network setup screen had what appears to be unescaped PHP (around the "WordPress Rules for Files" rule), which broke the XML file.

Generated XML:

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
				if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
					 .= '
                <rule name="WordPress Rule for Files" stopProcessing="true">
                    <match url="^blog/([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                    <action type="Rewrite" url="blog/C:\inetpub\wwwroot\wordpress\blog/wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
                 .= '
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^blog/([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                    <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
                <rule name="WordPress Rule 3" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 4" stopProcessing="true">
                    <match url="^blog/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                    <action type="Rewrite" url="blog/C:\inetpub\wwwroot\wordpress\blog/{R:1}" />
                <rule name="WordPress Rule 5" stopProcessing="true">
                    <match url="^blog/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="blog/C:\inetpub\wwwroot\wordpress\blog/{R:2}" />
                <rule name="WordPress Rule 6" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />

The same broken XML file can be accessed by visiting the "Network Setup" page from the Network Admin panel.

Attachments (1)

22920.patch (3.3 KB) - added by toscho 11 years ago.
fix syntax error

Download all attachments as: .zip

Change History (6)

#1 @TobiasBg
11 years ago

  • Keywords needs-patch added

Broken by [22042]. A heredoc block was added there, which wraps the PHP code.

11 years ago

fix syntax error

#2 @toscho
11 years ago

  • Cc info@… added

This should solve it. Not sure about the code style. A sprintf() might be easier to read …

#3 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.5.1
  • Severity changed from normal to major


#4 @markjaquith
11 years ago

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In 23177:

Fix code vomit in IIS rewrite rule generation. fixes #22920 for trunk. props toscho.

#5 @markjaquith
11 years ago

In 23178:

Fix code vomit in IIS rewrite rule generation. fixes #22920 for the 3.5 branch. props toscho.

Note: See TracTickets for help on using tickets.