Answer the question
In order to leave comments, you need to log in
What is Undefined offset?
Versions: php - 7.3, sim - 5.0
There is AclSubscriber, a subscription to CONTROLLER. The check function is called first.
public function check(ControllerEvent $event): void
{
$request = $event->getRequest();
if($request->headers->has('authorization')){
/** @var AccessTokenInterface $token */
$token = $this->container->get(AccessTokenInterface::class);
}else{
$token = null;
}
$acl = new AclPrivileges($token, $this->rules);
$a = (array) $event->getController();
$s = $a[1];
var_dump($s);
list($controller, $action) = [get_class($event->getController()), $s];
$resource = "{$controller}@{$action}";
$acl->isAllowed($resource);
return;
}
$s = $a[1];
, namely on $a[1]
, as you can see, the result is written to the variable $s
, but when the variable is wardumped, the contents of this variable are displayed (the same as for $a[1]), so this is the story: Answer the question
In order to leave comments, you need to log in
Everything is dumping fine for you - if you see, there is the word login on the screen at the top.
Obviously, the code works again, where there is no method and crashes, because this data is not available again ...
To find out, before receiving $s , do:
And show complete output of ALL values ...
In general, take the time and put xDebug, you would understand within 2 seconds what and where it arrives and why ...
If you chose debug as before on your knee, then the symphony has a dump () function, all calls which are displayed in the developer panel!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question