Code Modernization: Replace phpversion() function calls with PHP_VERSION constant.

`phpversion()` return value and `PHP_VERSION` constant value are identical, but the latter is several times faster because it is a direct constant value lookup compared to a function call.

Props ayeshrajans, jrf, mukesh27, costdev, hellofromTonya, SergeyBiryukov.
Fixes #55680.

git-svn-id: https://develop.svn.wordpress.org/trunk@53426 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-05-20 17:36:23 +00:00
parent 674ed76aa1
commit 5a49274a92
19 changed files with 32 additions and 37 deletions

View File

@@ -677,23 +677,18 @@ class WP_Debug_Data {
$server_architecture = 'unknown';
}
if ( function_exists( 'phpversion' ) ) {
$php_version_debug = phpversion();
// Whether PHP supports 64-bit.
$php64bit = ( PHP_INT_SIZE * 8 === 64 );
$php_version_debug = PHP_VERSION;
// Whether PHP supports 64-bit.
$php64bit = ( PHP_INT_SIZE * 8 === 64 );
$php_version = sprintf(
'%s %s',
$php_version_debug,
( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
);
$php_version = sprintf(
'%s %s',
$php_version_debug,
( $php64bit ? __( '(Supports 64bit values)' ) : __( '(Does not support 64bit values)' ) )
);
if ( $php64bit ) {
$php_version_debug .= ' 64bit';
}
} else {
$php_version = __( 'Unable to determine PHP version' );
$php_version_debug = 'unknown';
if ( $php64bit ) {
$php_version_debug .= ' 64bit';
}
if ( function_exists( 'php_sapi_name' ) ) {