Fix Long2IP issue with PHP7.1
Since PHP7.1, as long2ip expects an int, due to the strict_mode, PHP throws an error. Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
parent
0c66a6a4d1
commit
170714f033
@ -9,6 +9,7 @@
|
||||
namespace PhpMyAdmin\Plugins\Transformations\Abs;
|
||||
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* Provides common methods for all of the long to IPv4 transformations plugins.
|
||||
@ -41,14 +42,13 @@ abstract class LongToIPv4TransformationsPlugin extends TransformationsPlugin
|
||||
*/
|
||||
public function applyTransformation($buffer, array $options = array(), $meta = '')
|
||||
{
|
||||
if ($buffer < 0 || $buffer > 4294967295) {
|
||||
if (! Util::isInteger($buffer) || $buffer < 0 || $buffer > 4294967295) {
|
||||
return htmlspecialchars($buffer);
|
||||
}
|
||||
|
||||
return long2ip($buffer);
|
||||
return long2ip((int) $buffer);
|
||||
}
|
||||
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
/**
|
||||
|
||||
@ -4741,4 +4741,16 @@ class Util
|
||||
|
||||
return self::linkOrButton($url, $title . $orderImg, $orderLinkParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that input is an int or an int in a string
|
||||
*
|
||||
* @param mixed $input
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInteger($input)
|
||||
{
|
||||
return (ctype_digit((string) $input));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user