fix: rename config to cas_config in CasClientAuthBackend and CasStaffAuthBackend #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Symptom
When updating to osTicket 1.17, several users got the following error :
Fatal error: Cannot redeclare non static AuthenticationBackend::$config as static CasStaffAuthBackend::$config in phar://C:/include/plugins/auth-cas.phar/cas.php
. See issue #35Cause
After investigating, it appears that 6 month ago during the development of the multi-instance feature, the following commit was issued to the core osTicket repo : osTicket/osTicket@0b93b48. This commit created a new protected attribute
config
for theAuthenticationBackend
class.However, in the auth-cas plugin, the
CasStaffAuthBackend
andCasClientAuthBackend
both have an already declaredconfig
attribute since 7 years, and extends respectively osTicket classesExternalStaffAuthenticationBackend
andExternalUserAuthenticationBackend
, which in turn extends respectivelyStaffAuthenticationBackend
andUserAuthenticationBackend
which in turn extendsAuthenticationBackend
which had the newconfig
attribute. This attribute being only protected, it went all the way down to our classes :CasStaffAuthBackend
andCasClientAuthBackend
, conflicting with theirconfig
attribute.Solution
Our attribute being private, the easiest solution I have thinked of is changing the name of our variable
config
tocas_config
in our two classesCasStaffAuthBackend
andCasClientAuthBackend
. Because they are private, they can only be accessed within the source code of theses two classes, so the scope of the fix keeps limited and simple.Tests
Phar successfully rebuilt and works under osticket v1.17
Additional question
@kevinoconnor7 I can try to provide some fixes or updates as I already done in #33 while being a maintainer of this repo with you if you wish.
I would like to try this things :
That would be already enough for now !