Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase { public..

Decoded Output download

<?php

final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase {

  public function testAddressSimilarity() {
    $env = PhabricatorEnv::beginScopedEnv();
    $env->overrideEnvConfig('metamta.single-reply-handler-prefix', 'prefix');

    $base = '[email protected]';

    $same = array(
      '[email protected]',
      '"Abrahamn Lincoln" <[email protected]>',
      '[email protected]',
      '[email protected]',
    );

    foreach ($same as $address) {
      $this->assertTrue(
        PhabricatorMailUtil::matchAddresses(
          new PhutilEmailAddress($base),
          new PhutilEmailAddress($address)),
        pht('Address %s', $address));
    }

    $diff = array(
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
    );

    foreach ($diff as $address) {
      $this->assertFalse(
        PhabricatorMailUtil::matchAddresses(
          new PhutilEmailAddress($base),
          new PhutilEmailAddress($address)),
        pht('Address: %s', $address));
    }
  }

  public function testReservedAddresses() {
    $default_address = id(new PhabricatorMailEmailEngine())
      ->newDefaultEmailAddress();

    $void_address = id(new PhabricatorMailEmailEngine())
      ->newVoidEmailAddress();

    $map = array(
      '[email protected]' => false,
      '[email protected]' => true,
      '[email protected]' => true,
      '"Walter Ebmaster" <[email protected]>' => true,
      (string)$default_address => true,
      (string)$void_address => true,
    );

    foreach ($map as $raw_address => $expect) {
      $address = new PhutilEmailAddress($raw_address);

      $this->assertEqual(
        $expect,
        PhabricatorMailUtil::isReservedAddress($address),
        pht('Reserved: %s', $raw_address));
    }
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase {

  public function testAddressSimilarity() {
    $env = PhabricatorEnv::beginScopedEnv();
    $env->overrideEnvConfig('metamta.single-reply-handler-prefix', 'prefix');

    $base = '[email protected]';

    $same = array(
      '[email protected]',
      '"Abrahamn Lincoln" <[email protected]>',
      '[email protected]',
      '[email protected]',
    );

    foreach ($same as $address) {
      $this->assertTrue(
        PhabricatorMailUtil::matchAddresses(
          new PhutilEmailAddress($base),
          new PhutilEmailAddress($address)),
        pht('Address %s', $address));
    }

    $diff = array(
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
      '[email protected]',
    );

    foreach ($diff as $address) {
      $this->assertFalse(
        PhabricatorMailUtil::matchAddresses(
          new PhutilEmailAddress($base),
          new PhutilEmailAddress($address)),
        pht('Address: %s', $address));
    }
  }

  public function testReservedAddresses() {
    $default_address = id(new PhabricatorMailEmailEngine())
      ->newDefaultEmailAddress();

    $void_address = id(new PhabricatorMailEmailEngine())
      ->newVoidEmailAddress();

    $map = array(
      '[email protected]' => false,
      '[email protected]' => true,
      '[email protected]' => true,
      '"Walter Ebmaster" <[email protected]>' => true,
      (string)$default_address => true,
      (string)$void_address => true,
    );

    foreach ($map as $raw_address => $expect) {
      $address = new PhutilEmailAddress($raw_address);

      $this->assertEqual(
        $expect,
        PhabricatorMailUtil::isReservedAddress($address),
        pht('Reserved: %s', $raw_address));
    }
  }

}

Function Calls

None

Variables

None

Stats

MD5 88fecb701d9ee1c7af513bae5b3ce5de
Eval Count 0
Decode Time 103 ms