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 when include used with ternary operator #78

Closed
wants to merge 1 commit into from

Conversation

DavertMik
Copy link

fix for "$xx = ? include(xx) : 'yy'" thing (Yii2)

fix when include used with ternary operator like: https://github.com/yiisoft/yii2-framework/blob/master/yii/helpers/SecurityBase.php#L123

Yep, Go AOP was patching easier then Yii2

@DavertMik
Copy link
Author

Does this expression work in current version?
Is that used somewhere?
Should ? also be included as ending token?

@DavertMik
Copy link
Author

It's would be great to solve this in any way, because I'm trying to write the post about Yii2 for almost a week now :(
Without this patch Yii won't work.

@lisachenko
Copy link
Member

Does this expression work in current version?

Yes, it works

Is that used somewhere?

Not know exactly, but I have a feeling that I saw this expression early, so this is the case.

Should ? also be included as ending token?

No, this will make things much worse...

Unfortunately, there is no reliable way to cover all the cases, because expression can be any valid expression with ternary operators, brackets, parenthesis, etc. It's pitty, but Go! will support only restricted sets of include expression. This is known limitation.

@DavertMik
Copy link
Author

Oh, ok, thanks anyway.
I will send alternative PR into Yii2 core.

@DavertMik
Copy link
Author

Done :)
yiisoft/yii2#697

qiangxue pushed a commit to yiisoft/yii2-twig that referenced this pull request Jan 11, 2014
This is a very tiny patch that changes nothing in code logic, but is required to get [AspectMock](https://github.com/Codeception/AspectMock) and Go Aop working with Yii2. 

Go Aop is processing all `include` and `require` directives, replacing them with its filters. Unfortunately it doesn't play well with one-liners. So I had to break the code into few lines to get that working. 

I was trying to fix this issue in [Go Aop](goaop/framework#78) but looks like, the only option is to fix that in Yii2.

AspectMock can dramaticly improve unit testing in Yii2, and I plan to do a blogpost with tutorial about it.
wenbin1989 pushed a commit to wenbin1989/yii2-framework that referenced this pull request Nov 17, 2014
This is a very tiny patch that changes nothing in code logic, but is required to get [AspectMock](https://github.com/Codeception/AspectMock) and Go Aop working with Yii2. 

Go Aop is processing all `include` and `require` directives, replacing them with its filters. Unfortunately it doesn't play well with one-liners. So I had to break the code into few lines to get that working. 

I was trying to fix this issue in [Go Aop](goaop/framework#78) but looks like, the only option is to fix that in Yii2.

AspectMock can dramaticly improve unit testing in Yii2, and I plan to do a blogpost with tutorial about it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants