Tag Archives: exception

Laravel TokenMismatchException database session

Questions: My $request->input(_token) is a mismatch of $request->session()->toke() when switching from file to database sessions. This is causing a CSRF TokenMismatchException. When switching back from database to file sessons driver the mismatch does not occur. Does anyone know why i get this mismatch and possibly how to resolve it? 🙂 What i have done: Using… Read More »

Turning query errors to Exceptions in MySQLi

Questions: I’m trying to turn MySQLi query errors to Exceptions, but couldn’t – mysqli_sql_exception is thrown only if it failed to connect the DB. I used mysqli_report(MYSQLI_REPORT_STRICT) and procedural MySQLi functions embedded to custom wrapper class. Former code: public function mysqlQuery($SQL) { $this->Result = mysqli_query($this->DBlink, $SQL); if($this->Result === false) throw new MySQLiQueryException($SQL, mysqli_error($this->DBlink), mysqli_errno($this->DBlink)); return… Read More »

Laravel FatalErrorException in Handler.php line 25

Questions: I’m getting the following error on random occasions, working on a Laravel 5.1 project on the latest homestead with PHP7 FatalErrorException in Handler.php line 25: Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of TypeError given, called in /home/vagrant/Code/henau/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 73 and defined in /home/vagrant/Code/henau/app/Exceptions/Handler.php:25 Stack trace:… Read More »

Laravel TokenMismatchException

Questions: Right now I’m learing laravel but I keep getting the exeption: TokenMismatchException in VerifyCsrfToken.php line 53: I’m trying to make an object of a migration and then write it to the database but for some reason it’s not working. This is my route.php: Route::get(‘/post/new’,array( ‘uses’=> ‘blog@newPost’, ‘as’ => ‘newPost’ )); Route::post(‘/post/new’, array ( ‘uses’… Read More »

TokenMismatchException in VerifyCsrfToken.php line 53 in Laravel 5.1

Questions: When I try to login show me token error. I have checked token in view form it’s right and when comment \App\Http\Middleware\VerifyCsrfToken::class, in the Kernel.php it makes me login but after Redirect to my dashboard I’m not logged in. I am using MAMP on mac. <div> <h1>Login</h1> <div> {!! Form::open([‘url’=>’user/login’,’class’ => ”]) !!} <input… Read More »

Symfony2: ResourceNotFoundException when using extends in a twig template

Questions: I have over-ridden the exception.html.twig in the following directory: app/Resources/TwigBundle/views/Exception I have another twig inside another bundle that I’d like to extend, so I did the following: {% extends ‘AcmeMainBundle::layout.html.twig’ %} but it always gives me this error: Fatal error: Uncaught exception ‘Symfony\Component\Routing\Exception\ResourceNotFoundException’ in /Users/Aditya/Sites/Acme/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php on line Why is this? Answers:

Zend_Controller_Router_Exception: “xyz” is not specified

Questions: I have a problem in my current Zend Framework application. In my Bootstrap I register these routes: protected function _initRouter() { $this->bootstrap(“FrontController”); $frontController = $this->getResource(“FrontController”); $route = new Zend_Controller_Router_Route( “:module/:id”, array( “controller” => “index”, “action” => “index” ), array(“id” => “\d+”) ); $frontController->getRouter()->addRoute(‘shortcutOne’, $route); $route = new Zend_Controller_Router_Route( “:module/:controller/:id”, array(“action” => “index”), array(“id” =>… Read More »

How can I tell PHP to dump exceptions as raw text instead of HTML?

Questions: When I’m developing my REST API in PHP I’m working with application/json output, so when I get errors while testing in the browser they look like this: <b>Fatal error</b>: Uncaught exception ‘Exception’ with message ‘PDO caught an error: array(3) { [0]=&gt; string(5) &quot;42000&quot; [1]=&gt; int(1065) [2]=&gt; string(15) &quot;Query was empty&quot; } And it gets… Read More »