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

SimpleXML objects being returned from Config.php, not strings #413

Open
ghost opened this issue Jan 5, 2023 · 1 comment · May be fixed by #420
Open

SimpleXML objects being returned from Config.php, not strings #413

ghost opened this issue Jan 5, 2023 · 1 comment · May be fixed by #420
Assignees
Labels
enhancement good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day

Comments

@ghost
Copy link

ghost commented Jan 5, 2023

There is potential for confusion or error (largely created by me) in that this statement and other function returns from the Config class -

$bannerText = $this->GetLocalInfoXML()->page_banner;

When $bannerText is subsequently returned from the function, it actually returns a SimpleXMLElement object and not a string. Subsequent use of the returned object usually works in context, due to implicit casting to a string, but it can behave unexpectedly e.g. '==' comparison between two such returned values from different elements will fail even when the string values are the same.

It would be safer if all returns from Config.php were explicitly cast to strings or other type as and where appropriate.

@gregcorbett
Copy link
Member

It would be safer if all returns from Config.php were explicitly cast to strings or other type as and where appropriate.

Sounds good to me :)

@gregcorbett gregcorbett added good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day labels Jan 5, 2023
@rowan04 rowan04 self-assigned this Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Issues that require "minimal" knowledge of the codebase hackathon Issues that could be solved within a day
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants