php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #70530
Patch php-uname-fix-for-windows-10 revision 2017-08-06 19:18 UTC by gideaow at gmail dot com
revision 2017-08-06 16:16 UTC by gideaow at gmail dot com
revision 2017-08-06 16:13 UTC by gideaow at gmail dot com
revision 2017-08-06 15:58 UTC by gideaow at gmail dot com

Patch php-uname-fix-for-windows-10 for PHP options/info functions Bug #70530

Patch version 2017-08-06 19:18 UTC

Return to Bug #70530 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: gideaow@gmail.com

function my_php_uname() {
	$uname = php_uname();
	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' AND substr(php_uname('r'), 0, 2) != '10') {
		if (preg_match('/(Windows (\d+(\.\d+)?))/i', $uname, $match1) AND preg_match('/Windows NT (10(\.\d+)?)/i', $_SERVER['HTTP_USER_AGENT'], $match2)) {
			$release = preg_replace('/build (\d+)/i', 'build 150xx', php_uname('v'));
			$release = str_replace($match1[1], 'Windows '.$match2[1], $release);
			$uname = php_uname('s') .' '. php_uname('n') .' '. $match2[1] . ' ' . $release . ' ' . php_uname('m');
		}
	}
	return $uname;
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC