From e42185c6727f35c816d356fd1d107f73b88a3b84 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 11 Feb 2023 18:31:58 -0600 Subject: [PATCH] BigInteger: fix for hex numbers with new lines in them --- phpseclib/Math/BigInteger.php | 6 +++--- tests/Unit/Math/BigInteger/TestCase.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php index 8d1291db..81b69ace 100644 --- a/phpseclib/Math/BigInteger.php +++ b/phpseclib/Math/BigInteger.php @@ -408,7 +408,7 @@ class BigInteger $x = substr($x, 1); } - $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); + $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#s', '$1', $x); $is_negative = false; if ($base < 0 && hexdec($x[0]) >= 8) { @@ -444,7 +444,7 @@ class BigInteger // (?getInstance('0xE932AC92252F585B3A80A4DD76A897C8B7652952FE788F6EC8DD640587A1EE5647670A8AD'); - $this->assertSame($x, $y); + $y = $this->getInstance('0xE932AC92252F585B3A80A4DD76A897C8B7652952FE788F6EC8DD640587A1EE5647670A8AD', 16); + $this->assertSame("$x", "$y"); } }