1
wishcraft
2.5.8 :: Update Error : ParseError: syntax error, unexpected 'new' (T_NEW)

Hey all how are you? I have recently been updating renderments.org from PHP5 earlier version of XOOPS 2.5 to XOOPS 2.5 with PHP7; now with the following error I was making some adjustments to this module and puting in __construct() calls instead of XoopsClassFunction() but that is the only change..

When i got it up and running I got the following error: Error : ParseError: syntax error, unexpected 'new' (T_NEW) - You can see it here on the following URLs:-

  • http://renderments.org/send-email/general-topics-and-subjects/send-the-webmasters-a-message/3.html
  • http://renderments.org/send-email/access-permissions/add-user-to-the-openrend-sourceforge-net-project/2.html
  • http://renderments.org/send-email/access-permissions/email-alias-allocation-request/1.html


I have in the contact us module for solicitors and the likes (Isn't that the greatest thing in self consumption I can't have any sort of which way anything in the page with header and forms lawsuit on my arse - anyway!!) I have grep'd the word 'new' recursively in the /modules/lawsuit and buffered it to a text file and gone line by line checking all the new statements and they are all right...

If you need me to package this one geekwrite; let me know so you can have it the same box operating to debug on...

Debugging Resources

  • http://au.labs.coop/renderments_org.sql.zip
  • http://au.labs.coop/renderments.org.7z

2
geekwright
Re: 2.5.8 :: Update Error : ParseError: syntax error, unexpected

Quote:

wishcraft wrote:
When i got it up and running I got the following error: Error : ParseError: syntax error, unexpected 'new' (T_NEW)


The most likely cause is a line like this:
$variable =& new SomeObject();


The problem is the & by reference operator.

Objects are always references now, and PHP7 complains if you use the by reference assignments with them. But when you add new in one of those assignments, it becomes a parse error -- it can't use it in that context.

Finding and fixing any occurrences like that example should fix it.

3
geekwright
Re: 2.5.8 :: Update Error : ParseError: syntax error, unexpected

There is a tool, php7cc, that we've used a lot when adapting code to PHP7. You might find it helpful.

It is available here:https://github.com/sstalle/php7cc

Login

Who's Online

157 user(s) are online (78 user(s) are browsing Support Forums)


Members: 0


Guests: 157


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits