OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
email
/
vendor
/
phpmailer
/
phpmailer
/
test
/
PHPMailer
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/10/2024 05:28:17 AM
rwxr-xr-x
📄
AddEmbeddedImageTest.php
6.45 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
AddStringAttachmentTest.php
5.19 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
AddStringEmbeddedImageTest.php
5.53 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
AddrFormatTest.php
2.08 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
AuthCRAMMD5Test.php
1.54 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
CustomHeaderTest.php
9.2 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
DKIMTest.php
9.51 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
DSNConfiguratorTest.php
6.49 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
EncodeQTest.php
3.96 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
EncodeStringTest.php
4.58 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
FileIsAccessibleTest.php
3.32 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
FilenameToTypeTest.php
2.22 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
GenerateIdTest.php
2.63 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
GetLastMessageIDTest.php
3.32 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
HasLineLongerThanMaxTest.php
4.69 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
Html2TextTest.php
9.79 KB
07/10/2024 05:25:13 AM
rw-r--r--
📄
ICalTest.php
4.32 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
IsPermittedPathTest.php
3.74 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
IsValidHostTest.php
4.18 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
LocalizationTest.php
18.51 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
MailTransportTest.php
3.67 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
MbPathinfoTest.php
5.74 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
MimeTypesTest.php
1.93 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
NormalizeBreaksTest.php
3.62 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
PHPMailerTest.php
47.39 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
ParseAddressesTest.php
14.27 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
PunyencodeAddressTest.php
4.77 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
QuotedStringTest.php
2.08 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
ReplyToGetSetClearTest.php
17.23 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
SetErrorTest.php
5.19 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
SetFromTest.php
7.08 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
SetTest.php
2.32 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
SetWordWrapTest.php
4.01 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
Utf8CharBoundaryTest.php
1.95 KB
07/10/2024 05:25:14 AM
rw-r--r--
📄
ValidateAddressCustomValidatorTest.php
3.65 KB
07/10/2024 05:25:15 AM
rw-r--r--
📄
ValidateAddressTest.php
17.2 KB
07/10/2024 05:25:15 AM
rw-r--r--
📄
WrapTextTest.php
6.05 KB
07/10/2024 05:25:15 AM
rw-r--r--
📄
XMailerTest.php
2 KB
07/10/2024 05:25:15 AM
rw-r--r--
Editing: ValidateAddressCustomValidatorTest.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 PHPMailer\Test\TestCase; /** * Test email address validation using a custom validator. * * @covers \PHPMailer\PHPMailer\PHPMailer::validateAddress */ final class ValidateAddressCustomValidatorTest extends TestCase { /** * Test injecting a one-off custom validator. */ public function testOneOffCustomValidator() { $callback = static function ($address) { return strpos($address, '@') !== false; }; self::assertTrue( PHPMailer::validateAddress('user@example.com', $callback), 'Custom validator false negative' ); self::assertFalse( PHPMailer::validateAddress('userexample.com', $callback), 'Custom validator false positive' ); } /** * Test setting the default validator to an injected function. */ public function testSetDefaultValidatorToCustom() { // Set the default validator to an injected function. PHPMailer::$validator = static function ($address) { return 'user@example.com' === $address; }; self::assertTrue( $this->Mail->addAddress('user@example.com'), 'Custom default validator false negative' ); // Need to pick a failing value which would pass all other validators // to be sure we're using our custom one. self::assertFalse( $this->Mail->addAddress('bananas@example.com'), 'Custom default validator false positive' ); // Set validator back to default PHPMailer::$validator = 'php'; // This is a valid address that FILTER_VALIDATE_EMAIL thinks is invalid. self::assertFalse( $this->Mail->addAddress('first.last@example.123'), 'PHP validator not behaving as expected' ); } /** * Test denying function name callables as validators. * * See SECURITY.md and CVE-2021-3603. * * @dataProvider dataRejectCallables * * @param string $callback Callback function name. * @param string $message Message to display if the test would fail. */ public function testRejectCallables($callback, $message) { require_once \PHPMAILER_INCLUDE_DIR . '/test/validators.php'; self::assertTrue(PHPMailer::validateAddress('test@example.com', $callback), $message); } /** * Data provider. * * @return array */ public function dataRejectCallables() { return [ // If a `php` function defined in validators.php successfully overrides this built-in validator name, // this would return false - and we don't want to allow that. 'php' => [ 'callback' => 'php', 'message' => 'Build-in php validator overridden', ], // Check that a non-existent validator name falls back to a built-in validator // and does not call a global function with that name. 'phpx' => [ 'callback' => 'phpx', 'message' => 'Global function called instead of default validator', ], ]; } }