WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#10186 closed enhancement (wontfix)

Add global $server_version

Reported by: peaceablewhale Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: General Keywords: has-patch tested
Focuses: Cc:

Description

A number of workarounds/features are specific to IIS in WordPress Core. However, some workarounds/features apply to certain IIS versions only. I suggest adding a global $iis_version.

Attachments (1)

10186.patch (1.3 KB) - added by peaceablewhale 5 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 dd325 years ago

The other option, is to change the $is_* variables to the version (if known).

ie.

if ( test for iis )
  $is_iis = (is version known?) ? version : true;
}}
same for apache and all the others too..

{{{
if ( $is_apache )
}}}
would still work, just as long  as its non-null/non-false/non-zero

semi-crazy idea..

comment:2 dd325 years ago

I was thinking of that for browsers as well, Ie, If Opera is >= 10, or IE 5 or 6.. etc..

comment:3 peaceablewhale5 years ago

However, it is possible that some fcuntion may be checking those $is_ variables as boolean. I am afraid that changing them to version numbers may break compatibility with them.

What do you think?

comment:4 peaceablewhale5 years ago

Will break ($is_iis === true).

comment:5 dd325 years ago

What do you think?

I think its possible. However, a point that we dont need to worry about.

$version = 10.4;

var_dump( $version == true );

true

PHP will evaluate anything non-false/null/zero to be true in the above example.

(Of course, $version === true would be false, But thats going to be rarely used, a triple check along with a true.. most people are just going to do if($iis)

comment:6 dd325 years ago

If it was a problem, Introducing a new variable for it for future..

$apache = apache_version();
$iis = iis_version();

leaving $is_... alone for back compat

comment:7 peaceablewhale5 years ago

  • Summary changed from Add global $iis_version to Add global $server_version

I have uploaded a new patch that generates $server_version instead of $iis_version.

peaceablewhale5 years ago

comment:8 peaceablewhale5 years ago

Forgot to change $is_iis7 just now..

comment:9 westi5 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I think we should move away from referencing versions completely.

We should be working on capabilities not versions.

The current implementation of IIS7 specific stuff will break as soon as IIS8 is used even if it supports everything that is required because we check explicitly for 7.

I don't think we should be making globals available with version numbers of things like this in them and so I am going to close this ticket.

comment:10 peaceablewhale5 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

However, the server version number is required for fixing #10186, and we will also need to care IIS URL_Rewirte when IIS 8 is released. I think adding global $server_version is useful.

comment:11 peaceablewhale5 years ago

Correction: this is required for fixing #10187

comment:12 westi5 years ago

  • Resolution set to wontfix
  • Status changed from reopened to closed

We should not create globals with server version in.

It encourages checks to be made that should be better made on capabilities.

If we need a capabilite check like iis_supports_rewrites that could have to check a version but the version extraction should be encapsulated where it is used not stored in a global to encourage miss-use.

Note: See TracTickets for help on using tickets.