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

Don't call ->self() on string literals (ie. Fix "Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)") #20

Open
silbinarywolf opened this issue Aug 2, 2018 · 6 comments

Comments

@silbinarywolf
Copy link
Contributor

silbinarywolf commented Aug 2, 2018

Bug:
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /shared/httpd/front-end-tooling/htdocs/silverstripe-cache/deploy/.cache.themes.patternlab.templates.forms.FormAction.ss on line 17

Code:

<:FormButton
    Class="$getAttribute("class")"
    Label="<% if $ButtonContent %>$ButtonContent<% else %>$Title.XML<% end_if %>"
    IsSubmit="<% if $getAttribute("type") == "submit" %>1<% else %>0<% end_if %>"
    IsButton="<% if $getAttribute("type") == "button" %>1<% else %>0<% end_if %>"
    IsReset="<% if $getAttribute("type") == "reset" %>1<% else %>0<% end_if %>"
    AttributesHTML="$getAttributesHTML(class, type)"
/>

Output in template: (retrieved from silverstripe-cache folder)

if ($scope->locally()->obj('getAttribute', array('type'), true)=='button') { 
$_props['IsButton'][] = '1'->self();
}else { 
$_props['IsButton'][] = '0'->self();
}
@JoshuaCarter
Copy link
Contributor

JoshuaCarter commented Nov 17, 2018

@me See:

$value = str_replace(array('XML_val(', ';'), array('obj(', '->self();'), $value);

@JoshuaCarter JoshuaCarter self-assigned this Nov 17, 2018
@nglasl
Copy link
Contributor

nglasl commented Jan 7, 2019

@JoshuaCarter any update on this one and whether it remains relevant? Your comment above confuses me greatly, heh :)

@JoshuaCarter
Copy link
Contributor

@nglasl Still relevant as I've not made any changes here. My above comment is just a link to the offending code.

@nglasl
Copy link
Contributor

nglasl commented Jan 8, 2019

Is this something you're working on fixing for a project? Just wondering if it needs to be assigned to you.

@JoshuaCarter
Copy link
Contributor

@nglasl I'm not aware of it being a current issue with any project (part of why it's been neglected). Anyone is welcome to take it off my hands.

@nglasl
Copy link
Contributor

nglasl commented Jan 8, 2019

No worries, I will unassign you from this if that's the case. If this is something we start to encounter, I'll look at assigning it to someone for resolution. For anyone else playing along at home, a PR is more than welcome here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants