How to retrieve location of unexpected token?

Discussion about the open-source Phalanger [?] project.

How to retrieve location of unexpected token?

Postby johnc » August 22nd, 2013, 7:08 am

I'm trying to run a wordpress plugin that fails to compile when activating.

The error logged is:
[22-Aug-2013 07:03:52] CompileError: Syntax error: unexpected token '}'

I'd like to find where this unexpected token is in the source code (it's many files) and fix it - how can I get Phalanger to tell me the source code file and location within the file that the unexpected token is found in?
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » August 22nd, 2013, 2:13 pm

Hi,

Good question. Locations in .NET are available if you are compiling in debug mode (so .pdb files are generated).

If you are compiling from command line, using phpc.exe, specify "/debug+" argument.

Otherwise, add folowing into your web.config, into <phpNet><compiler> section:
Code: Select all
<set name="Debug" value="true" />

Please give me know if it works for you,
Thanks
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: How to retrieve location of unexpected token?

Postby johnc » August 22nd, 2013, 4:03 pm

I still didn't get any file/position information in the error log.

I've pasted my Web.Config file here: http://privatepaste.com/04694dc213

I think I configured it all properly.

I'm running under mono 3.0.12 (mono 2.10 caused a fatal Emit exception).

Interestingly, compiling the same source files on windows with phpc.exe doesn't give me any compile errors.
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » August 22nd, 2013, 4:20 pm

if you run <?php phpinfo(); ?> you should see whether you are really in Debug mode or not (right on top, aside of the Phalanger version)

Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: How to retrieve location of unexpected token?

Postby johnc » August 22nd, 2013, 4:28 pm

It appears I'm not.

I get the Phalanger header with the version and cpu arch, no mention of debug mode.
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » August 22nd, 2013, 4:40 pm

I've tried to run .php file in debug/release (on Windows), and it is getting me syntax error location in any mode.
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: How to retrieve location of unexpected token?

Postby johnc » August 28th, 2013, 3:08 am

We are running on linux under mono. Just can't seem to find out where the error is occuring in order to fix it.

I'd gladly try any suggestions at this point.

EDIT:

I ran the compiler from the command line, compiling just the plugin itself and didn't get the unexpected token error. Maybe the plugin is calling out to some broken WP code?
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » August 28th, 2013, 1:56 pm

Maybe it is including something out of the plugins directory.

Anyway "unexpected token" error has always the location; I can't find any case where it doesn't.

Do you have a chance of debugging the application? Catching any exception, or put a breakpoint into Phalanger code?
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: How to retrieve location of unexpected token?

Postby johnc » August 30th, 2013, 6:01 am

We can't run a debug session locally as we don't own a license for the Phalanger Visual Studio tools yet.

We're in the process of testing the phalanger asp.net hosting component for our wordpress network and, understandably, we can't put down cash for what is a relatively unknown and unproven technology.

We really are anxious to get off php-fpm though so I'm hoping it works out well in the end.
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » August 30th, 2013, 1:20 pm

I mean debugging Phalanger itself; just attach the debugger to the web server process.

Anyway if you can locate the plugin causing this? I can take a look locally and give you know.

Thanks
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2092
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Next

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 124 on September 25th, 2020, 6:57 am

Users browsing this forum: No registered users and 1 guest