How to retrieve location of unexpected token?

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

Re: How to retrieve location of unexpected token?

Postby johnc » September 2nd, 2013, 10:49 pm

Do you have a guide somewhere on debugging phalanger sites from visual studio?

The plugin is a purchased plugin so it can't really be shared.

I started up the trial of the php tools in visual studio to try and debug but it appears that the site is running under php not phalanger.
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » September 4th, 2013, 12:23 pm

For debugging Phalanger site, you may upgrade to Phalanger Tools (http://www.devsense.com/products/phalanger-tools) This contains IntelliSense of Phalanger libraries and .NET, etc.

Anyway if you are not able to retrieve location of a parse error, that's not an issue inside PHP code (well it is issue in PHP code, but Phalanger should display the location). I just can't find any scenario where Phalanger does not show location of CompileError: Syntax error: unexpected token '}'

Are you able to reproduce this on Windows/IIS ? Then it is straight forward to debug site and give me info I need to solve your issue:

1. Run you site, in your browser open the page that causes the parse error
2. Open Visual Studio (do not open any solution, not needed)
3. go to Debug | Attach to Process
4. ensure Attach to: contains Managed (v4.5, v4.0)
5. find w3wp.exe (it is IIS Application Pool, so if there are more of them, you need to find the one corresponding with your site)
6. click Attach
7. go to Debug | Options and Settings, untick Enable Just My Code
9. go to Debug | Exception, tick Common Language Runtime Exceptions
10. hit F5 in your browser and send me Call Stack of any exception thrown :-)

Thanks,
You do not have the required permissions to view the files attached to this post.
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 » September 5th, 2013, 1:20 am

Locally we don't have IIS. We've always been using mono on linux for deploying the site and locally we only have IIS express.

Starting IIS Express from command line to run the site won't actually load the site. It gives an InvalidOperation exception on line: PHP.Core.LibraryConfigurationsSection.GetConfig(PhpLibraryDescriptor descriptor) +126

My thinking is that mono may be at fault here and just reproducing the unexpected token problem will give me the location under windows.
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » September 5th, 2013, 6:39 am

Do you compile Phalanger by yourself? I can send you modified PhpNetCore.dll which will output some additional information.
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 » September 5th, 2013, 9:44 pm

Alright,

I spent some time today setting up IIS and following the phalanger config wiki page to get everything setup on my slow little laptop.

I tried to enable the trouble plugin on the IIS install and got the unexpected token error but this time it included the php file, line and column of the error!

The moral of this story is: mono is hiding the error details for some reason.

@Jakub Misek:

It looks like the phalanger parser is having trouble with what is legitimate code. It's structured a little oddly but the Visual Studio syntax highlighting is showing the '}' in question to be valid. Would you like a copy of the code file in question? If so, do you have a way for me to send it to you privately?
johnc
 
Posts: 45
Joined: March 24th, 2013, 9:17 pm

Re: How to retrieve location of unexpected token?

Postby Jakub Misek » September 5th, 2013, 10:05 pm

Great it works on IIS/.NET at least! I'll try this kind of error on mono and we'll see ..

If you have any code, that you expect to be parsed properly; please send it to me to the email in my signature. That would be very appreciated.

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

Previous

Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 6 guests

cron

User Control Panel

Login

Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 5 minutes)
Most users ever online was 151 on December 6th, 2020, 7:46 am

Users browsing this forum: No registered users and 6 guests