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 /** * This file is part of the Phalcon Framework. * * (c) Phalcon Team <team@pha..
Decoded Output download
<?php
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Phalcon\Tests\Unit\Http\Request;
use Phalcon\Tests\Unit\Http\Helper\HttpBase;
use UnitTester;
class GetPortCest extends HttpBase
{
/**
* Tests Request::getPort
*
* @author Phalcon Team <[email protected]>
* @since 2016-06-26
*/
public function testHttpRequestPort(UnitTester $I)
{
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com');
$I->assertSame(
443,
$request->getPort()
);
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com');
$I->assertSame(
80,
$request->getPort()
);
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com:8080');
$I->assertSame(
8080,
$request->getPort()
);
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com:8081');
$I->assertSame(
8081,
$request->getPort()
);
unset(
$_SERVER['HTTPS']
);
$this->setServerVar('HTTP_HOST', 'example.com:8082');
$I->assertSame(
8082,
$request->getPort()
);
}
}
?>
Did this file decode correctly?
Original Code
<?php
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Phalcon\Tests\Unit\Http\Request;
use Phalcon\Tests\Unit\Http\Helper\HttpBase;
use UnitTester;
class GetPortCest extends HttpBase
{
/**
* Tests Request::getPort
*
* @author Phalcon Team <[email protected]>
* @since 2016-06-26
*/
public function testHttpRequestPort(UnitTester $I)
{
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com');
$I->assertSame(
443,
$request->getPort()
);
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com');
$I->assertSame(
80,
$request->getPort()
);
$request = $this->getRequestObject();
$this->setServerVar('HTTPS', 'off');
$this->setServerVar('HTTP_HOST', 'example.com:8080');
$I->assertSame(
8080,
$request->getPort()
);
$this->setServerVar('HTTPS', 'on');
$this->setServerVar('HTTP_HOST', 'example.com:8081');
$I->assertSame(
8081,
$request->getPort()
);
unset(
$_SERVER['HTTPS']
);
$this->setServerVar('HTTP_HOST', 'example.com:8082');
$I->assertSame(
8082,
$request->getPort()
);
}
}
Function Calls
None |
Stats
MD5 | bb25743a853574a10ca15da8ddd47f83 |
Eval Count | 0 |
Decode Time | 124 ms |