Exception not caught by ZF2 - zend-framework2

In the onBootstrap of my Application's Module.php I have registered a function onErrors on the EVENT_DISPATCH and EVENT_DISPATCH_ERROR events. In any of my models if I throw a custom error, Zend will catch it for me and in the onErrors function and I can handle the error (show an error page, return an error message as json, etc). This works fine except when an error is thrown in a function that's being used by Smarty. In that case I do still end up in the onErrors, but McvEvent->exception is NULL and I get this error:
Fatal error: Uncaught exception 'Application\Exception\InternalServerErrorException' in
/........../module/Smarty/src/Smarty/View/Renderer.php:90 Stack trace:
#0 /........../vendor/zendframework/zendframework/library/Zend/View/View.php(205):
Smarty\View\Renderer->render(Object(Zend\View\Model\ViewModel))
#1 /........../vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(102):
Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#2 [internal function]:
Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#3 /........../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#4 /........../vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('render.error',
Object(Zend\Mvc\MvcEvent), Array)
#5 /.......... in
/........../module/Smarty/src/Smarty/View/Renderer.php on line 90
What's happening here? Why isn't Zend catching this error for me?

Related

error in processmaker login page after installation

I installed processmaker 3.5.7 on debian stable and there is an error in login page after installtion :
Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120 Stack trace: #0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL) #1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(App\Foundation\Application), Array) #2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure)) #3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Il in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120
Fatal error: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120 Stack trace: #0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL) #1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(App\Foundation\Application), Array) #2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure)) #3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Il in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php on line 120
apache2 2.4.38
php 7.3
mariadb 10.3.27
processmaker logs :
<400> Apr 27 01:33:12 production ERROR: Call to undefined method Monolog\Logger::singleton() {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined method Monolog\\Logger::singleton() at /opt/processmaker/vendor/laravel/framework/src/Illuminate/Log/Logger.php:273)"}
<400> Apr 27 01:33:12 production ERROR: Uncaught TypeError: Argument 2 passed to Illuminate\Routing\UrlGenerator::__construct() must be an instance of Illuminate\Http\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120
Stack trace:
#0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\Routing\UrlGenerator->__construct(Object(Illuminate\Routing\RouteCollection), NULL, NULL)
#1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\Routing\RoutingServiceProvider->Illuminate\Routing\{closure}(Object(App\Foundation\Application), Array)
#2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\Container\Container->build(Object(Closure))
#3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Il {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Uncaught TypeError: Argument 2 passed to Illuminate\\Routing\\UrlGenerator::__construct() must be an instance of Illuminate\\Http\\Request, null given, called in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php on line 62 and defined in /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120\nStack trace:\n#0 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(62): Illuminate\\Routing\\UrlGenerator->__construct(Object(Illuminate\\Routing\\RouteCollection), NULL, NULL)\n#1 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(776): Illuminate\\Routing\\RoutingServiceProvider->Illuminate\\Routing\\{closure}(Object(App\\Foundation\\Application), Array)\n#2 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(658): Illuminate\\Container\\Container->build(Object(Closure))\n#3 /opt/processmaker/vendor/laravel/framework/src/Illuminate/Container/Container.php(609): Il at /opt/processmaker/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:120)"}
To make better use of ProcessMaker, it is better to use the Windows version as well
this is what you said about your simulator

Fatal error: Uncaught Error: "Presta vers. 1.6.1.18

My prestashop gives the following errors:
Fatal error: Uncaught Error: Call to a member function getProducts() on null in /var/www/html/minie.dk/public_html/modules/productsbundle/productsbundle.php:181 Stack trace: #0 /var/www/html/minie.dk/public_html/classes/Hook.php(591): ProductsBundle->hookActionCartSave(Array) #1 /var/www/html/minie.dk/public_html/classes/Hook.php(546): HookCore::coreCallHook(Object(ProductsBundle), 'hookactionCartS...', Array) #2 /var/www/html/minie.dk/public_html/classes/Cart.php(214): HookCore::exec('actionCartSave') #3 /var/www/html/minie.dk/public_html/classes/controller/FrontController.php(327): CartCore->update() #4 /var/www/html/minie.dk/public_html/classes/controller/Controller.php(170): FrontControllerCore->init() #5 /var/www/html/minie.dk/public_html/classes/Dispatcher.php(367): ControllerCore->run() #6 /var/www/html/minie.dk/public_html/index.php(28): DispatcherCore->dispatch() #7 {main} thrown in /var/www/html/minie.dk/public_html/modules/productsbundle/productsbundle.php on line 181
Can Anyone here see what the problem may be? And also, how to save it?
This problem is related to your 'productsbundle' module when a product is added to the customer's shopping cart.
I would suggest either to update this module to the latest version available or to disable it from your admin panel.

Cannot nest placeholder captures for the same placeholder'

i am making an ajax call to the controller, i dont know wants going wrong and this error is coming.
can someone explain this error.
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Cannot nest placeholder captures for the same placeholder' in E:\xampp\htdocs\xnspy-web-app\xnspy-cp\vendor\ZF2\View\Helper\Placeholder\Container\AbstractContainer.php:141 Stack trace: #0 E:\xampp\htdocs\xnspy-web-app\xnspy-cp\module\Application\view\partial\global-head.phtml(5): Zend\View\Helper\Placeholder\Container\AbstractContainer->captureStart() #1 E:\xampp\htdocs\xnspy-web-app\xnspy-cp\vendor\ZF2\View\Renderer\PhpRenderer.php(506): include('E:\xampp\htdocs...') #2 E:\xampp\htdocs\xnspy-web-app\xnspy-cp\vendor\ZF2\View\Helper\Partial.php(61): Zend\View\Renderer\PhpRenderer->render('partial/global-...', NULL) #3 [internal function]: Zend\View\Helper\Partial->__invoke('partial/global-...') #4 E:\xampp\htdocs\xnspy-web-app\xnspy-cp\vendor\ZF2\View\Renderer\PhpRenderer.php(399): call_user_func_array(Object(Zend\View\Helper\Partial), Array) #5 E:\xampp\htdocs\xnspy-web-app\xnspy-cp\module\Application\view\layout\ajax-layout.phtml(3): Z in E:\xampp\htdocs\xnspy-web-app\xnspy-cp\vendor\ZF2\View\Helper\Placeholder\Container\AbstractContainer.php on line 141
This error comes when u open capturestart two times in a row
placeholder('script')->captureStart(); ?>
placeholder('script')->captureStart(); ?>
eleminate one and problem is solved.

I want to show data from mysql database on browser using dart

I'm working on school project, which requires to show some simple data from mysql database in browser. I've read, that SQLJocky doesn't work in browser so I decided to make it like server-client app and run db on server side (got inspiration here: https://dart-lang.github.io/server/codelab/). But it didn't work, failed in creating client api with message:
*in ShutdownIsolate: Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: Unhandled exception:
Load Error for "package:sqljocky/sqljocky.dart": No mapping for 'sqljocky' package when resolving 'package:sqljocky/sqljocky.dart'.
#0 _asyncLoadErrorCallback (dart:_builtin:155)
#1 _asyncLoadError (dart:_builtin:566)
#2 _loadPackage (dart:_builtin:605)
#3 _loadData (dart:_builtin:637)
#4 _loadDataAsync (dart:_builtin:657)
#5 _loadScriptCallback (dart:_builtin:153)
#6 _handleLoaderReply (dart:_builtin:370)
#7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
'file:///home/alenka/dart-pokusy/server-side-app/one-hour-codelab/server/7-serve/lib/server/dbConnector.dart': error: line 1 pos 1: library handler failed
import 'package:sqljocky/sqljocky.dart';
^
#0 Isolate.spawnUri.<spawnUri_async_body> (dart:isolate-patch/isolate_patch.dart)
#1 _asyncErrorWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:34)
#2 _RootZone.runBinary (dart:async/zone.dart:1154)
#3 _Future._propagateToListeners.handleError (dart:async/future_impl.dart:579)
#4 _Future._propagateToListeners (dart:async/future_impl.dart:641)
#5 _Future._completeError (dart:async/future_impl.dart:432)
#6 _SyncCompleter._completeError (dart:async/future_impl.dart:56)
#7 _Completer.completeError (dart:async/future_impl.dart:27)
#8 Isolate._spawnCommon.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:439)
#9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)*
Does anyone have idea how to solve this problem, or how to get data from db in browser differently?
Code added containing things from SQLJocky:
`import 'package:sqljocky/sqljocky.dart';
import 'dart:async';
...
#ApiMethod(path: 'connect')
Future<List<String>> dbConnect() async {
List<String> rows = [];
print('called dbConnect');
var pool = new ConnectionPool(
host: 'localhost',
port: 3306,
user: "root",
password: null,
db: 'project',
max: 5);
print('connection created');
var results = await pool.query('select * from User');
print('gonna write something from db');
results.forEach( (row){
print('Name: ${row[0]}, password: ${row[1]}');
rows.add('Name: ${row[0]}, password: ${row[1]}');
});
return rows;
}
`
Isolate your server side code and client side code into separates projects with their own pubspec.yaml.
I've found that sqljocky doesn't play nice with some of the client side libraries when both are in the pubspec.yaml.

Material Design Lite Dart, refreshing table

Is there a simple example of custom component in MDL Dart http://www.material-design-lite.pub using a data table or a list linked to a model changing over time?
I have the exception
Exception: Uncaught Error: RangeError: Index out of range: index should be less than 6: 6
Stack Trace:
#0 HtmlCollection.[] (dart:html:17296)
#1 _ChildrenElementList.[] (dart:html:10623)
#2 MaterialRepeat.insert.<insert_async_body> (package:mdl/src/template/components/MaterialRepeat.dart:148:55)
#3 Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
#4 _microtaskLoop (dart:async/schedule_microtask.dart:43)
#5 _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#6 _ScheduleImmediateHelper._handleMutation (dart:html:42503)
Using the custom ToDo sample when updating the items list

Resources