Private GIT

Skip to content
Snippets Groups Projects
Commit 491b48a6 authored by phpipam's avatar phpipam
Browse files

Fixed #3761 allowing all php8 versions

parent 663fd4f3
Branches
No related tags found
No related merge requests found
...@@ -59,6 +59,9 @@ $Addresses->ptr_unlink_subnet_addresses ($subnet->id); ...@@ -59,6 +59,9 @@ $Addresses->ptr_unlink_subnet_addresses ($subnet->id);
// fetch all hosts // fetch all hosts
$hosts = $Addresses->fetch_subnet_addresses ($subnet->id, "ip_addr", "asc"); $hosts = $Addresses->fetch_subnet_addresses ($subnet->id, "ip_addr", "asc");
// ignored
$ignored = [];
// create PTR records // create PTR records
if (is_array($hosts) && sizeof($hosts)>0) { if (is_array($hosts) && sizeof($hosts)>0) {
foreach ($hosts as $h) { foreach ($hosts as $h) {
......
...@@ -263,7 +263,7 @@ else { ...@@ -263,7 +263,7 @@ else {
# status icon # status icon
if($subnet['pingSubnet']=="1") { if($subnet['pingSubnet']=="1") {
//calculate //calculate
$tDiff = time() - strtotime($addresses[$n]->lastSeen); $tDiff = !is_null($addresses[$n]->lastSeen)>0 ? time() - strtotime($addresses[$n]->lastSeen) : time();
if($addresses[$n]->excludePing=="1" ) { $hStatus = "padded"; $hTooltip = ""; } if($addresses[$n]->excludePing=="1" ) { $hStatus = "padded"; $hTooltip = ""; }
elseif(is_null($addresses[$n]->lastSeen)) { $hStatus = "neutral"; $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='"._("Address was never online")."'"; } elseif(is_null($addresses[$n]->lastSeen)) { $hStatus = "neutral"; $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='"._("Address was never online")."'"; }
elseif($addresses[$n]->lastSeen == "0000-00-00 00:00:00") { $hStatus = "neutral"; $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='"._("Address is offline")."<hr>"._("Last seen").": "._("Never")."'";} elseif($addresses[$n]->lastSeen == "0000-00-00 00:00:00") { $hStatus = "neutral"; $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='"._("Address is offline")."<hr>"._("Last seen").": "._("Never")."'";}
......
...@@ -15,7 +15,7 @@ if(!defined('PHPIPAM_PHP_MIN')) ...@@ -15,7 +15,7 @@ if(!defined('PHPIPAM_PHP_MIN'))
define('PHPIPAM_PHP_MIN', "5.4"); define('PHPIPAM_PHP_MIN', "5.4");
if(!defined('PHPIPAM_PHP_UNTESTED')) if(!defined('PHPIPAM_PHP_UNTESTED'))
define('PHPIPAM_PHP_UNTESTED', "8.2"); // PHP 8.2 or greater is untested & unsupported define('PHPIPAM_PHP_UNTESTED', "9.0"); // PHP 8.2 or greater is untested & unsupported
if (phpversion() >= PHPIPAM_PHP_UNTESTED) { if (phpversion() >= PHPIPAM_PHP_UNTESTED) {
$_SESSION['footer_warnings']['php_version'] = _('Unsupported PHP version ') . phpversion(); $_SESSION['footer_warnings']['php_version'] = _('Unsupported PHP version ') . phpversion();
......
...@@ -1168,7 +1168,11 @@ class Common_functions { ...@@ -1168,7 +1168,11 @@ class Common_functions {
* @param bool $permit_root_domain * @param bool $permit_root_domain
* @return bool|mixed * @return bool|mixed
*/ */
public function validate_hostname($hostname, $permit_root_domain=true) { public function validate_hostname($hostname = "", $permit_root_domain=true) {
// null hostname is invalid
if(is_null($hostname)) {
return false;
}
// first validate hostname // first validate hostname
$valid = (preg_match("/^([a-z_\d](-*[a-z_\d])*)(\.([a-z_\d](-*[a-z_\d])*))*$/i", $hostname) //valid chars check $valid = (preg_match("/^([a-z_\d](-*[a-z_\d])*)(\.([a-z_\d](-*[a-z_\d])*))*$/i", $hostname) //valid chars check
&& preg_match("/^.{1,253}$/", $hostname) //overall length check && preg_match("/^.{1,253}$/", $hostname) //overall length check
......
...@@ -307,7 +307,7 @@ abstract class DB { ...@@ -307,7 +307,7 @@ abstract class DB {
return $this->ctes_enabled; return $this->ctes_enabled;
$db = Config::ValueOf("db"); $db = Config::ValueOf("db");
$ctes_enabled = filter_var($db['use_cte'], FILTER_VALIDATE_INT, ['options'=>['default' => 1, 'min_range' => 0, 'max_range' => 2]]); $ctes_enabled = filter_var(@$db['use_cte'], FILTER_VALIDATE_INT, ['options'=>['default' => 1, 'min_range' => 0, 'max_range' => 2]]);
if ($ctes_enabled===0) { // Disable CTE Support if ($ctes_enabled===0) { // Disable CTE Support
$this->ctes_enabled = false; $this->ctes_enabled = false;
...@@ -380,7 +380,7 @@ abstract class DB { ...@@ -380,7 +380,7 @@ abstract class DB {
* Reset engine type if set in config.php (MEMORY or InnoDB) * Reset engine type if set in config.php (MEMORY or InnoDB)
*/ */
$db = Config::ValueOf('db'); $db = Config::ValueOf('db');
$tmptable_engine_type = ($db['tmptable_engine_type']=="InnoDB") ? "InnoDB" : "MEMORY"; $tmptable_engine_type = (@$db['tmptable_engine_type']=="InnoDB") ? "InnoDB" : "MEMORY";
try { try {
// Emulate SQL CTE query using temporary tables. // Emulate SQL CTE query using temporary tables.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment