php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67407 Windows 8.1/Server 2012 R2 reported as Windows 8/Server 2012
Submitted: 2014-06-10 08:39 UTC Modified: 2014-07-08 08:01 UTC
From: wenz@php.net Assigned: ab
Status: Closed Package: PHP options/info functions
PHP Version: master-Git-2014-06-10 (Git) OS: Windows 8.1
Private report: No CVE-ID:
 [2014-06-10 08:39 UTC] wenz@php.net
Description:
------------
The phpinfo() output on Windows 8.1 and Windows Server 2012 R2 reports the OS as Windows 8 and Windows Server 2012.

This is due to the deprecation of GetVersionEx (which we are using) on these platforms - http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074%28v=vs.85%29.aspx

Once we compile the Windows builds with the Visual Studio 2013 compiler and the Windows 8.1 SDK, _NT_TARGET_VERSION=$(_NT_TARGET_VERSION_LATEST) seems to help. However until then we need a different approach. 

VerifyVersionInfo (http://msdn.microsoft.com/en-us/library/windows/desktop/ms725491%28v=vs.85%29.aspx) looks like the best solution to me. It is slower than GetVersionEx, so we should only run it if we detect Windows 8/Server 2012 and then need to decide whether it's 8.1/2012 R2 instead. The attached patch proposes an implementation. 



Test script:
---------------
<?php
  phpinfo(INFO_GENERAL);

Expected result:
----------------
Output contains "Windows 8.1" on a Windows 8.1 machine.
Output contains "Windows Server 2012 R2" on a Windows Server 2012 R2 machine.

Actual result:
--------------
Output contains "Windows 8" (and not 8.1) on a Windows 8.1 machine.
Output contains "Windows Server 2012" (and not R2) on a Windows Server 2012 R2 machine.

Patches

detect-Win81-Server2012R2 (last revision 2014-06-10 08:40 UTC) by wenz@php.net)

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-10 08:40 UTC] wenz@php.net
The following patch has been added/updated:

Patch Name: detect-Win81-Server2012R2
Revision:   1402389611
URL:        https://bugs.php.net/patch-display.php?bug=67407&patch=detect-Win81-Server2012R2&revision=1402389611
 [2014-07-08 08:01 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2014-07-08 08:01 UTC] ab@php.net
Merged in 4883a60bb3412e5c776153703d7e0ff0a490482b , also backported into 5.4+
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC