darsain / laravel-console

In-browser console for Laravel PHP framework.
170 stars 44 forks source link

Code ended unexpectedly #23

Closed JasonTolliver closed 10 years ago

JasonTolliver commented 10 years ago

Not sure if I'm doing something wrong here, but even on the simplest of code it gives me output errors and tells me my code ended unexpectedly.

screen shot 2013-11-25 at 7 28 40 pm

darsain commented 10 years ago

Well, I can't replicate this. What happens when you add @ in front of ob_end_clean() in vendor/darsain/laravel-console/src/routes.php:15 ?

    }
    @ob_end_clean();
    Console::addProfile('error', array(
JasonTolliver commented 10 years ago

Still getting a parsing error, quite strange:

{"queries":[],"memory":3407872,"memory_peak":3407872,"time":0,"time_queries":0,"time_total":24,"output":"","output_size":0,"error":{"type":"E_PARSE","message":"syntax error, unexpected '\"', expecting T_STRING","file":"\/webroot\/practicegenius\/jtolliver\/laravel\/vendor\/darsain\/laravel-console\/src\/Darsain\/Console\/Console.php(111) : eval()'d code","line":1}}{"queries":[],"memory":3670016,"memory_peak":3670016,"time":0,"time_queries":0,"time_total":27,"output":"","output_size":0,"error":{"type":500,"message":"syntax error, unexpected '\"', expecting T_STRING","file":"\/webroot\/practicegenius\/jtolliver\/laravel\/vendor\/darsain\/laravel-console\/src\/Darsain\/Console\/Console.php(111) : eval()'d code","line":1}} 
JasonTolliver commented 10 years ago

An interesting discovery... It seems that it has to do with strings. I killed the script directly after line 111 of vendor/darsain/laravel-console/src/Darsain/Console/Console.php and got this:

screen shot 2013-11-26 at 4 53 22 pm

JasonTolliver commented 10 years ago

btw I'm using MAMP, php 5.3.14, on osx Mavericks

I'm looking around, it might be something in my configuration

JasonTolliver commented 10 years ago

Indeed I was able to recreate the same error by simply running this php file in the command line:

<?php

eval('echo \"dad\";');

Has to do with the single quotes that surround the string within eval. If they're double quotes, no trouble at all... Not sure what exactly it is about my setup that gives me such a ridiculously strict sort of error, my error reporting in php.ini is set to E_ALL so shouldn't be giving issues.. Oh well, I can probably hack something together to make it all work

JasonTolliver commented 10 years ago

Got it! It was magic_quotes :P

Gotta have that turned off. Not sure if you want a quick runtime check for that somewhere, might ale troubleshooting easier for anybody running < 5.4, though at this point it may just be a waste of time.

Thanks for your time!

darsain commented 10 years ago

Ok, I just want to make sure that prepending the error suppression sign @ fixed the error reporting, meaning that console started showing you that nice graphical error description (red rectangle with line number and error message) instead of that malformed JSON string.

Or did you made any other tweaks?

JasonTolliver commented 10 years ago

It did not, only when I killed it manually after the actual eval() on line 111 did it display it nicely.

darsain commented 10 years ago

How did you "killed it manually"?

ankur0101 commented 10 years ago

I am also facing the problem. I am using Laravel 4.1.

screenshot

Line 1 syntax error, unexpected '"', expecting T_STRING Execution failed: 500 Internal Server Error

darsain commented 10 years ago

@ankur0101 have you tried turning off magic_quotes? As suggested in comment above?