Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public function getWebdriver()
*/
private function getOs()
{
$os = php_uname('s');
$os = PHP_OS;
Copy link
Contributor

@wilsonge wilsonge Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the same thing according to http://php.net/manual/en/function.php-uname.php - there's a difference of PHP_OS being what PHP was built with rather than what it's running on

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know.
However, there should only be two cases here, if I am not mistaken.

  1. PHP was installed from a precompiled package. Those packages are precompiled for essentially the same type of system they will be running on. So there should be no difference here.
  2. PHP was compiled on the system it currently runs on. No difference to the previous behavior, either.

To summarize: The 's' parameter only would return the name of the system: 'Linux', 'Windows', 'MacOs', etc. So would the proposed change.
If you have a prebuilt package for Linux, it will have been built on Linux. Same goes for the other architectures.

Unless I am missing or misunderstanding something?


if (strpos(strtolower($os), 'windows') !== false)
{
Expand Down
4 changes: 2 additions & 2 deletions administrator/components/com_admin/Model/SysinfoModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ public function &getInfo()
'dbversion' => $db->getVersion(),
'dbcollation' => $db->getCollation(),
'dbconnectioncollation' => $db->getConnectionCollation(),
'phpversion' => phpversion(),
'phpversion' => PHP_VERSION,
'server' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : getenv('SERVER_SOFTWARE'),
'sapi_name' => php_sapi_name(),
'sapi_name' => PHP_SAPI,
'version' => (new Version)->getLongVersion(),
'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ function admin_postinstall_joomla40checks_condition()
}

// PHP minimum version is 7.0
return version_compare(PHP_VERSION, '7.0', 'lt');
return PHP_VERSION_ID < 70000;
}
2 changes: 1 addition & 1 deletion administrator/components/com_joomlaupdate/restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
if (function_exists('php_uname'))
{
define('_AKEEBA_IS_WINDOWS', stristr(php_uname(), 'windows'));
define('_AKEEBA_IS_WINDOWS', stristr(PHP_OS, 'windows'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not touch restore.php please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes.. sorry. will revert.

}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function getStats(&$params)
$rows[$i] = new \stdClass;
$rows[$i]->title = \JText::_('MOD_STATS_PHP');
$rows[$i]->icon = 'cogs';
$rows[$i]->data = phpversion();
$rows[$i]->data = PHP_VERSION;
$i++;

$rows[$i] = new \stdClass;
Expand Down
2 changes: 1 addition & 1 deletion build/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

use Joomla\CMS\Version;

if (version_compare(PHP_VERSION, '5.4', '<'))
if (PHP_VERSION_ID < 50400)
{
echo "The build script requires PHP 5.4.\n";

Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Application/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ protected function loadSystemUris($requestUri = null)
$uri = \JUri::getInstance($this->get('uri.request'));

// If we are working from a CGI SAPI with the 'cgi.fix_pathinfo' directive disabled we use PHP_SELF.
if (strpos(php_sapi_name(), 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
{
// We aren't expecting PATH_INFO within PHP_SELF so this should work.
$path = dirname($_SERVER['PHP_SELF']);
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Cache/Storage/ApcStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static function isSupported()
$supported = extension_loaded('apc') && ini_get('apc.enabled');

// If on the CLI interface, the `apc.enable_cli` option must also be enabled
if ($supported && php_sapi_name() === 'cli')
if ($supported && PHP_SAPI === 'cli')
{
$supported = ini_get('apc.enable_cli');
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Cache/Storage/ApcuStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public static function isSupported()
$supported = extension_loaded('apcu') && ini_get('apc.enabled');

// If on the CLI interface, the `apc.enable_cli` option must also be enabled
if ($supported && php_sapi_name() === 'cli')
if ($supported && PHP_SAPI === 'cli')
{
$supported = ini_get('apc.enable_cli');
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Uri/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public static function base($pathonly = false)
{
static::$base['prefix'] = $uri->toString(array('scheme', 'host', 'port'));

if (strpos(php_sapi_name(), 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
if (strpos(PHP_SAPI, 'cgi') !== false && !ini_get('cgi.fix_pathinfo') && !empty($_SERVER['REQUEST_URI']))
{
// PHP-CGI on Apache with "cgi.fix_pathinfo = 0"

Expand Down
4 changes: 2 additions & 2 deletions modules/mod_stats/Helper/StatsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public static function &getList(&$params)
{
$rows[$i] = new \stdClass;
$rows[$i]->title = \JText::_('MOD_STATS_OS');
$rows[$i]->data = substr(php_uname(), 0, 7);
$rows[$i]->data = substr(PHP_OS, 0, 7);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this - it's definitely not the same thing - it's almost the same as php_uname('s') - but with no parameters it gives much more information than PHP_OS

$i++;

$rows[$i] = new \stdClass;
$rows[$i]->title = \JText::_('MOD_STATS_PHP');
$rows[$i]->data = phpversion();
$rows[$i]->data = PHP_VERSION;
$i++;

$rows[$i] = new \stdClass;
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/stats/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ private function getStatsData()
'db_type' => $this->db->name,
'db_version' => $this->db->getVersion(),
'cms_version' => JVERSION,
'server_os' => php_uname('s') . ' ' . php_uname('r')
'server_os' => PHP_OS . ' ' . php_uname('r')
);
}

Expand Down