mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Fix php8 uncaught fatal error: Unsupported operand types string * int
This commit is contained in:
		| @@ -52,11 +52,15 @@ function mask2cidr($mask) | |||||||
|  */ |  */ | ||||||
| function cidr2mask($cidr) | function cidr2mask($cidr) | ||||||
| { | { | ||||||
|     $ta = substr ($cidr, strpos ($cidr, '/') + 1) * 1; |     $ipParts = explode('/', $cidr); | ||||||
|     $netmask = str_split (str_pad (str_pad ('', $ta, '1'), 32, '0'), 8); |     $ip = $ipParts[0]; | ||||||
|     foreach ($netmask as &$element) |     $prefixLength = $ipParts[1]; | ||||||
|       $element = bindec ($element); |  | ||||||
|     return join ('.', $netmask); |     $ipLong = ip2long($ip); | ||||||
|  |     $netmaskLong = bindec(str_pad(str_repeat('1', $prefixLength), 32, '0')); | ||||||
|  |     $netmask = long2ip($netmaskLong); | ||||||
|  |  | ||||||
|  |     return $netmask; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user