Use of undefined constant ‘Main’
We have a new theme that are converting to C5: We have one page defined with a single template. We have done this many times in the past except using php 5.6.3 so we are comfortable with what we are doing. Also, we reviewed Andrews HTML to C5 vids and confirmed all of our steps.
We simply added an area and now get the error a above (more details below).
Here is the area (inside of a simple div). We've tried without a class, same error.
$a = new Area(‘Main’);
# concrete5 Version
Core Version - 8.5.4
Version Installed - 8.5.4
Database Version - 20200609145307
Complete Error Thrown (can provide the stack trace if needed):
Whoops\Exception\ErrorException thrown with message "Use of undefined constant ‘Main’ - assumed '‘Main’'
(this will throw an Error in a future version of PHP)"
If we change to PHP 5.6.3 (which is what we've used for eons), we get no error, but when adding a content block, the progress bar goes all the way to the right and the little spinny wheel just keeps going around and around. We can add an HTML, Feature Block and a few others - haven't really tested everything, but a Content Block is obviously a key item.
I would really appreciate any insight or suggestions.
Thanks all and enjoy the rest of the holiday season.
We have only one page template, so not the solution but something to keep in mind going forward.
Also checked here:
https://documentation.concrete5.org/building-website-concrete5/5-add... as well as other posts.
Exactly the same code.
Again, when running php 5.x no issue, php7 - rears it's ugly head.
I do appreciate the pingback..
Please look closely and you will see that you have used single curly quotes (zoom in).
PHP 7 is less forgiving of such typo errors and this is why you are now seeing the error.
This error... assumed '‘Main’' is displaying single straight quotes wrapping single curly quotes.
That is the problem, you have copied and pasted single curly quotes and PHP 7 will not accept that.
The Forum Admins are unlikely to correct that typo error as they are not interested in supporting any legacy documentation.
Hell, it looks like they are not even interested in fixing this broken forum!
So please take my word for it, you must use single STRAIGHT quotes and not single CURLY quotes when writing code for PHP 7.
See the attached image!