- Issue created by @indrapatil
- Assigned to indrapatil
- Status changed to Needs work
over 1 year ago 9:22am 2 March 2023 - @indra-patil opened merge request.
- Issue was unassigned.
- 🇮🇳India indrapatil Bangalore
Hi,
Still we have this errors to workphpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig likeit-3345426/
FILE: /var/www/html/drupal9/likeit-3345426/likeit.module
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
432 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
442 | ERROR | The $_COOKIE super global must not be accessed directly; inject the request_stack service and use $stack->getCurrentRequest()->cookies->get('likeit_session') instead
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Time: 572ms; Memory: 14MB
- Assigned to imustakim
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:35am 3 March 2023 - 🇮🇳India imustakim Ahmedabad
Added a patch for fixes.
Please review. - Status changed to Needs work
over 1 year ago 2:09pm 3 March 2023 - 🇺🇦Ukraine andrew_tspkh
@imustakim, please have a look on this code:
$stack->getCurrentRequest()->cookies->get('likeit_session') = $session_id;
Can't use method return value in write context.
- Assigned to imustakim
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 3:52pm 3 March 2023 - Status changed to Needs work
over 1 year ago 4:12pm 3 March 2023 - 🇺🇦Ukraine andrew_tspkh
$likeit_session = $stack->getCurrentRequest()->cookies->get('likeit_session'); $likeit_session = $session_id;
Has no sense, because here we need to set cookie. And in code above you just assign session Id to variable that never be used.
I think that good code is:$stack->getCurrentRequest()->cookies->set('likeit_session', $session_id);
Also please check functions/variables doc parts where you put new parameters:
@param Drupal\Core\Render\RendererInterface $renderer
should be:
@param \Drupal\Core\Render\RendererInterface $renderer
- Assigned to imustakim
- Issue was unassigned.
- Status changed to Fixed
over 1 year ago 11:14pm 18 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.