-
- 24,544 Posts
Is there some trick that will allow you to get a PHP syntax error message when a MODx plugin doesn’t run because of a coding error?
-
- 1,336 Posts
Do you have this in your php.ini,
display_errors = On
. This will dump php errors to your web page, so when you go into the manager and load the component, if it borks you get an error message and stack trace etc. This is set on my dev boxes so I get this on any PHP error.
Use MODx, or the cat gets it!
Revo has it’s own error_handler class that by default logs to the core/cache/logs/error.log. You can see this from the manager or file system. Or you can change it in the plugin to use an ’HTML’ logTarget ($modx->setLogTarget()) to see any errors generated after that point, though you should set it back at the end of execution (it returns the old setting when you change it). However, if you have a syntax error in your code, that would create a FATAL error and PHP will stop execution and log and/or display the error itself, based on display_errors as shamblett indicated.
-
- 24,544 Posts
I do have
in php.ini.
I get syntax error messages when a bad snippet loads, but for some reason my plugins just die quietly if I’m in the Manager.
-
- 24,544 Posts
The following plugin hooked to OnDocFormSave, leads to an animated save progress bar that never goes away.
If I hook it to OnBeforeChunkFormDelete, nothing happens. The chunk is not deleted.
In neither case do I see any error message:
-
- 1,336 Posts
I can reproduce this also and get nothing on the screen, but I do get this in the error log,
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP Parse error: syntax error, unexpected ’;’, expecting ’)’ in /var/www/html/local/revolution/revolution/core/cache/elements/modplugin/2.include.cache.php on line 7, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP Stack trace:, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 1. {main}() /var/www/html/local/revolution/revolution/connectors/resource/index.php:0, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 2. modConnectorRequest->handleRequest() /var/www/html/local/revolution/revolution/connectors/resource/index.php:3, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 3. modConnectorRequest->prepareResponse() /var/www/html/local/revolution/revolution/core/model/modx/modconnectorrequest.class.php:66, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 4. modConnectorResponse->outputContent() /var/www/html/local/revolution/revolution/core/model/modx/modconnectorrequest.class.php:77, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 5. include() /var/www/html/local/revolution/revolution/core/model/modx/modconnectorresponse.class.php:76, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 6. modX->invokeEvent() /var/www/html/local/revolution/revolution/core/model/modx/processors/resource/update.php:375, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 7. modScript->process() /var/www/html/local/revolution/revolution/core/model/modx/modx.class.php:1285, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
[Fri Apr 02 09:32:41 2010] [error] [client ::1] PHP 8. modScript->loadScript() /var/www/html/local/revolution/revolution/core/model/modx/modscript.class.php:43, referer: http://localhost/revolution/revolution/manager/index.php?a=43&id=1
so the error is being caught but not bounced back to the page.
Can’t say I’ve sen this before but I guess whats happening is that the syntax error does indeed stop execution, so we don’t send an AJAX reply back to the save document action we’ve just invoked, so it just sits there.
Use MODx, or the cat gets it!
if you want to see the results of an AJAX request, use Fx with HttpFox extension. If FATAL errors occur in AJAX requests, there is nothing you can do to get a valid response to the AJAX handler.
-
- 24,544 Posts
Quote from: OpenGeek at Apr 02, 2010, 01:46 PM
if you want to see the results of an AJAX request, use Fx with HttpFox extension. If FATAL errors occur in AJAX requests, there is nothing you can do to get a valid response to the AJAX handler.
Got it. Thanks.