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

Bugfix: SSViewer check object exists before calling prop or method_exists #10589

Conversation

chrispenny
Copy link
Contributor

$on can be null (there is no property type enforcement for item in the __construct()), and when it is the method_exists() call will throw an error (as it expects object or class for the first param).

Another option could be do write it as method_exists($on ?? '', $property ?? ''), but I thought maybe this was a bit more descriptive.

My particular project comes across this issue when we use SSViewerCacheBlockTest::_runtemplate(), but there might be other situations where item is null.

@michalkleiner michalkleiner merged commit f57a77d into silverstripe:4.11 Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants