Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Maintenance listener throwing deprecation exception on PHP 7.4 in dev environment #93

Closed
wants to merge 1 commit into from
Closed

Maintenance listener throwing deprecation exception on PHP 7.4 in dev environment #93

wants to merge 1 commit into from

Conversation

manowark
Copy link

@manowark manowark commented Apr 1, 2020

Deprecation type: Trying to access array offset on value of type null.

Steps to reproduce:

  • change priority of the MaintenanceListener to execute in before Symfonys RouteListener (must be empty _route` in the Request)
  • use PHP 7.4
  • execute application in dev mode
  • enable E_ALL error_reporting in the php.ini

Additional info: https://wiki.php.net/rfc/notice-for-non-valid-array-container

… environment

 - fixed the maintenance listener to handle case when request route is not set
 - updated unit test
 - added new versions of PHP (7.3 and 7.4) to the test list
@@ -194,7 +194,10 @@ public function onKernelRequest(GetResponseEvent $event)
}

$route = $request->get('_route');
if (null !== $this->route && preg_match('{'.$this->route.'}', $route) || (true === $this->debug && '_' === $route[0])) {
if ($route && (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is correct, is it? See #95.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is covered by test and this approach is used in our project.

@manowark manowark closed this Jan 27, 2022
@manowark manowark deleted the fix/issue_with_empty_request_route_7.4 branch January 27, 2022 13:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants