[wp-trac] [WordPress Trac] #45970: in IIS if web.confing <configuration has xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" attribute the WordPress creates new <configuration> section and the site craches with wrong web.config
WordPress Trac
noreply at wordpress.org
Sun Jan 13 12:12:38 UTC 2019
#45970: in IIS if web.confing <configuration has
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" attribute the
WordPress creates new <configuration> section and the site craches with
wrong web.config
----------------------------+-----------------------------
Reporter: boychev | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 5.0.3
Severity: normal | Keywords: needs-patch
Focuses: administration |
----------------------------+-----------------------------
in IIS if web.confing <configuration has
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0" attribute the
WordPress creates new <configuration> section and the site craches with
wrong web.config error (2 <configuration> sections). It happens/triggers
by example if you are trying to change the "Permalink Settings".
The code responsible for this check is located in \wp-
admin\includes\misc.php (line 748)
// First check if the rule already exists as in that case there is
no need to re-add it
$wordpress_rules =
$xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-
with(@name,\'wordpress\')] |
/configuration/system.webServer/rewrite/rules/rule[starts-
with(@name,\'WordPress\')]');
if ( $wordpress_rules->length > 0 )
return true;
The fix could be to register the namespace:
$xpath->registerNamespace("x",
"http://schemas.microsoft.com/.NetConfiguration/v2.0");
and then in $xpath->query to check also for
/x:configuration/x:system.webServer/x:rewrite/x:rules/x:rule[starts-
with(@name,\'WordPress\')]
In this way it works without problem and does not break the site.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45970>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list