-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
Null Coalescence doesn't return fallback if falsey variable uses a modifier #2022
Comments
Confirms. I was struggling for a long time with this one: |
Confirmed. Will see what I can do! Weirdly enough, the issue seems more related to the
|
Unfortunately, we have to revert the change we made as we noticed it introduced unrelated issues. We'll get back to this though! |
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me. |
Open sesame |
Fixes problem where if "excerpt" is blank, the first 160 characters of "content" are not displayed. This is related to "Null Coalescence doesn't return fallback if falsey variable uses a modifier #2022" issue located at statamic/cms#2022
I ran across this problem in the "Cool Writings" starter kit ( https://github.com/statamic/starter-kit-cool-writings ) if the "excerpt" is blank since the code uses the "widont" modifier. I submitted a pull request, mentioned above, to solve the problem in the starter kit based on the information provided above. |
Fixes problem where if "excerpt" is blank, the first 160 characters of "content" are not displayed. This is related to "Null Coalescence doesn't return fallback if falsey variable uses a modifier #2022" issue located at statamic/cms#2022
Bug Description
When using ?? or "or" to display a variable with a fallback it comes back blank if the first variable is null and has a modifier applied to it, even if the fallback variable is not null. However, Ternary format does work as expected.
How to Reproduce
Create something like this with the first variable being a null one and the second one existing, it will return nothing:
{{alt_title|upper ?? title|upper}}
This will return the title variable (as expected):
{{alt_title ?? title}}
This will return the title variable in uppercase (as expected):
{{alt_title ? alt_title|upper : title|upper}}
Extra Detail
Environment
Statamic version: 3.0.0.-beta-33
PHP version: 7.4
Install method (choose one):
statamic/statamic
The text was updated successfully, but these errors were encountered: