Closed jhon100 closed 5 years ago
Hello.
Just follow http://shieldon.lo/en/guide/yii.html FirewallPanel instance will generate the settings to a JSON configuration file and the Firewall instance will read the configuration and initialize Shieldon instance for you.
You can ignore The Basics
part.
Right and what about the others errors? I'm having problems with the Type declarations
In addition to the errors mentioned:
FirewallTrait - public function getShieldon() : object
Fatal error: Uncaught TypeError: Return value of Shieldon\Firewall::getShieldon() must be an instance of Shieldon\object, instance of Shieldon\Shieldon returned in ...\vendor\terrylinooo\shieldon\src\Shieldon\FirewallTrait.php on line 63
You may want to add to the Yii documentation that you need to include this snippet in order to save information in the FirewallPanel.
$controlPanel->csrf(\Yii::$app->request->csrfParam, \Yii::$app->request->csrfToken);
Ignore the bulti-in CSRF protection in FirewallPanelController:
<?php
namespace app\controllers;
use yii\web\Controller;
class FirewallPanelController extends Controller
{
public function beforeAction($action)
{
$this->enableCsrfValidation = false;
return parent::beforeAction($action);
}
/**
* The entry point of the Firewall Panel.
*
* @return string
*/
public function actionIndex()
{
// Get Firewall instance from Shieldon Container.
$firewall = \Shieldon\Container::get('firewall');
// Get into the Firewall Panel.
$controlPanel = new \Shieldon\FirewallPanel($firewall);
$controlPanel->entry();
exit;
}
}
Let me install PHP 7.1 to test. I will downgrade my phpunit version to support testing for 7.1 Please wait for my next reply. Thank you.
Hello. I have modified code to make it compatible with PHP 7.1 Could you try again? (version 3.1.4) Thank you very much for opening the first issue here.
Wow it was a lot of changes ... thank you so much, everything is working fine now :)
Hi, i just installed your firewall and despite using the settings of this link https://shieldon.io/en/guide/yii.html, the following errors are being presented:
1 - Fatal error: Declaration of Shieldon\Driver\FileDriver::doInitialize($dbCheck = true): void must be compatible with Shieldon\Driver\AbstractDriver::doInitialize(bool $dbCheck = true): void in {mypath}\vendor\terrylinooo\shieldon\src\Shieldon\Driver\FileDriver.php on line 32 -- I'm using php 7.1.17 if it matters -- If I change to FileDriver::doInitialize(booln $dbCheck = true), the following error occur:
2 - Argument 1 passed to Shieldon\FirewallPanel::__construct() must be an instance of Shieldon\object, instance of Shieldon\Firewall given, called in {mypath}\controllers\FirewallPanelController.php on line 20 -- The controller code is exactly the same presented in the guide
3 - Another question would be about the documentation. In https://shieldon.io/en/docs/configuration.html it shows these snippets:
In https://shieldon.io/en/guide/yii.html
It is not clear where in Yii I should use the config code and how to relate the two objects.