magento2: 'Parse error: syntax error, unexpected end of file' due to open PHP tag
Preconditions (*)
This error is happening after updating to 2.2.10. It seems this commit (https://github.com/magento/magento2/commit/7f346f38a54d0d5f2ff7a3c1a6cbbdf0aa3c338f) introduced loads of open PHP tags. Not sure why this is, it’s not been done on the 2.3.x branch … Admin/backend loads, just frontend which is broken
Steps to reproduce (*)
Not sure; updated from 2.2.9 to 2.2.10 and just deployed the changes to my Staging env.
Expected result (*)
No errors, site should just load the homepage correctly.
Actual result (*)
When trying to load the homepage I get a single error message;
Parse error: syntax error, unexpected end of file in /...project-path.../http/var/view_preprocessed/pub/static/vendor/magento/module-reports/view/frontend/templates/js/components.phtml on line 1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (4 by maintainers)
Attached a patch that I tested on a Magento Cloud environment.
https://kayser-roth-public.s3.amazonaws.com/25551.patch
git-filter-branch line 420, can you give me this file for comparing ? @0x15f C:/Program Files/Git/mingw64/libexec/git-core\git-filter-branch: eval: line 420: syntax error: unexpected end of file
I started going that direction @tiacocstoe but found that there were so many. I ended up making a patch that runs as part of our deployment process. Here is a link to the patch if anyone needs it until Magento fixes the issue.
Two things that strike me about this bug, without knowing the actual solution yet: One, the PHTML file that throws the error is “minified” (so it becomes a single line with 2 opening tags). Two, why is this PHTML template copied to a
var/view_preprocessed/pub/static
folder anyway, while it should never end up in the folderpub
because it is not a web-accessible file?Did somebody create a deployment trick that minifies any (!) file that resides in any (!)
js
folder?