Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix enotice when Log service is swapped out #20146

Merged
merged 1 commit into from
May 5, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 26, 2021

Overview

Fix enotice when Log service is swapped out

Before

If the service retrieved by Civi::log() is NOT an instance of CRM_Core_Error_Log then there will be an enotice as there is no map property in the interface & there cannot be expected to be one in any alternate services

After

The array can be retrieved from a public function.

Technical Details

This function is calling a property on the psr_log service that may not exist. If the
service is swapped out there is no reason the replacement should have this property.

@civibot
Copy link

civibot bot commented Apr 26, 2021

(Standard links)

@civibot civibot bot added the master label Apr 26, 2021
@eileenmcnaughton
Copy link
Contributor Author

@colemanw can I get a merge on this - it fixes an issue from when you added logObserver (an obscure one)

@eileenmcnaughton
Copy link
Contributor Author

@colemanw would be good to get this merged before we fork - it's arguably a regression of sorts

@colemanw
Copy link
Member

colemanw commented May 4, 2021

I guess the alternative would be to move the array to some central spot accessible to both.

@eileenmcnaughton
Copy link
Contributor Author

@colemanw yeah I guess I dithered a little but then went with 'don't overthink it' - this is a very standard array & not one that would ever change

@colemanw
Copy link
Member

colemanw commented May 4, 2021

For example a public static function getMap() in CRM_Core_Error_Log which returns the array, and also gets called by its constructor for populating $this->map.

This function is calling a property on the psr_log service that may not exist. If the
service is swapped out there is no reason the replacement should have this property.
@colemanw
Copy link
Member

colemanw commented May 5, 2021

@eileenmcnaughton I updated it, MOP

@eileenmcnaughton
Copy link
Contributor Author

OK - I was gonna move it to CRM_Core_Error as a more appropriate place to put a static function but this fixes it

@seamuslee001 seamuslee001 merged commit 1b80505 into civicrm:master May 5, 2021
@seamuslee001 seamuslee001 deleted the log branch May 5, 2021 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants