OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
Xpress
/
vendor
/
phpmailer
/
phpmailer
/
test
/
PHPMailer
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:16 AM
rwxr-xr-x
📄
AddEmbeddedImageTest.php
6.45 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
AddStringAttachmentTest.php
5.19 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
AddStringEmbeddedImageTest.php
5.53 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
AddrFormatTest.php
2.08 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
AuthCRAMMD5Test.php
1.54 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
CustomHeaderTest.php
9.2 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
DKIMTest.php
9.51 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
DSNConfiguratorTest.php
6.49 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
EncodeQTest.php
3.96 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
EncodeStringTest.php
4.58 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
FileIsAccessibleTest.php
3.32 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
FilenameToTypeTest.php
2.22 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
GenerateIdTest.php
2.63 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
GetLastMessageIDTest.php
3.32 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
HasLineLongerThanMaxTest.php
4.69 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
Html2TextTest.php
9.79 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ICalTest.php
4.32 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
IsPermittedPathTest.php
3.74 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
IsValidHostTest.php
4.18 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
LocalizationTest.php
18.51 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
MailTransportTest.php
3.67 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
MbPathinfoTest.php
5.74 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
MimeTypesTest.php
1.93 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
NormalizeBreaksTest.php
3.62 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
PHPMailerTest.php
47.39 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ParseAddressesTest.php
14.27 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
PunyencodeAddressTest.php
4.77 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
QuotedStringTest.php
2.08 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ReplyToGetSetClearTest.php
17.23 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
SetErrorTest.php
5.19 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
SetFromTest.php
7.08 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
SetTest.php
2.32 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
SetWordWrapTest.php
4.01 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
Utf8CharBoundaryTest.php
1.95 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ValidateAddressCustomValidatorTest.php
3.65 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
ValidateAddressTest.php
17.2 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
WrapTextTest.php
6.05 KB
05/19/2025 10:07:16 AM
rw-r--r--
📄
XMailerTest.php
2 KB
05/19/2025 10:07:16 AM
rw-r--r--
Editing: IsValidHostTest.php
Close
<?php /** * PHPMailer - PHP email transport unit tests. * PHP version 5.5. * * @author Marcus Bointon <phpmailer@synchromedia.co.uk> * @author Andy Prevost * @copyright 2012 - 2020 Marcus Bointon * @copyright 2004 - 2009 Andy Prevost * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License */ namespace PHPMailer\Test\PHPMailer; use PHPMailer\PHPMailer\PHPMailer; use Yoast\PHPUnitPolyfills\TestCases\TestCase; /** * Test host validation functionality. * * @covers \PHPMailer\PHPMailer\PHPMailer::isValidHost */ final class IsValidHostTest extends TestCase { /** * Test host validation when a valid host is passed. * * @dataProvider dataValidHost * * @param string $input Input text string. */ public function testValidHost($input) { self::assertTrue(PHPMailer::isValidHost($input), 'Good hostname denied'); } /** * Data provider. * * @return array */ public function dataValidHost() { return [ 'localhost' => ['localhost'], 'Domain alias' => ['a'], 'Domain: lowercase' => ['example.com'], 'Domain: uppercase' => ['EXAMPLE.COM'], 'Domain: mixed case' => ['Example.Com'], 'Domain: with dash' => ['my-example.com'], 'Domain: with subdomain' => ['smtp.gmail.com'], 'IPv4 address: 127.0.0.1' => ['127.0.0.1'], 'IPv4 address: external' => ['27.145.58.181'], 'Long hex address' => [trim(str_repeat('a0123456789.', 21), '.')], 'Bracketed IPv6: localhost' => ['[::1]'], 'Bracketed IPv6' => ['[0:1234:dc0:41:216:3eff:fe67:3e01]'], 'Bracketed IPv6 uppercase' => ['[0:1234:DC0:41:216:3EFF:FE67:3E01]'], ]; } /** * Test host validation when an invalid host is passed. * * @dataProvider dataInvalidHost * * @param string $input Input text string. */ public function testInvalidHost($input) { self::assertFalse(PHPMailer::isValidHost($input), 'Bad hostname accepted'); } /** * Data provider. * * @return array */ public function dataInvalidHost() { return [ 'Invalid type: null' => [null], 'Invalid type: int' => [123], 'Invalid type: float' => [1.5], 'Invalid type: object' => [new \stdClass()], 'Invalid type: array' => [[]], 'Invalid input: empty string' => [''], 'Invalid input: domain - empty subdomain' => ['.example.com'], 'Invalid input: domain - with underscore' => ['my_example.com'], 'Invalid input: IPv4, no dots' => ['127001'], 'Invalid input: IPv4, too few groups' => ['168.0.001'], 'Invalid input: IPv4, too many groups' => ['22.55.14.73.9'], 'Invalid input: IPv4 address outside range' => ['999.0.0.0'], 'Invalid input: hex address, wrong size' => [trim(str_repeat('a0123456789.', 22), '.')], 'Invalid input: bracketed, not IPv6 (num)' => ['[1234]'], 'Invalid input: bracketed, not IPv6 (hex)' => ['[abCDef]'], 'Invalid input: bracketed, triple :' => ['[1234:::1]'], 'Invalid input: IPv6 empty brackets' => ['[]'], 'Invalid input: IPv6 without brackets' => ['0:1234:dc0:41:216:3eff:fe67:3e01'], 'Invalid input: IPv6 too few groups' => ['[0:1234:dc0:41]'], 'Invalid input: IPv6 too many groups' => ['[012q:1234:dc0:41:216:3eff:fe67:3e01:6fa5]'], 'Invalid input: IPv6 non-hex char' => ['[012q:1234:dc0:41:216:3eff:fe67:3e01]'], 'Invalid input: IPv6 disallowed chars' => ['[0:12_4:dc$:41:216:3e+f:fe67:3e01]'], 'Invalid input: IPv6 double bracketed' => ['[[::1]]'], ]; } }