Errors are not being sent to rollbar Laravel 5.1 - php

When I throw new Exception('test exception'); from a class the bug is passed to my rollbar dashboard. But when I cause a Laravel error, something like:
"syntax error, unexpected '$user' (T_VARIABLE)"
it doesn’t get passed.
I have it working perfectly on another project and it sends all bugs but that is in Laravel 5.0. I then tried Laravel Rollbar by jenssegers, thinking it would be more suited for Laravel 5.1 but that behaves the exact same way, only passing exceptions that I explicitly throw.

Try removing any third party packages that would interfere with the Handler class in the exceptions directory. The likes of filp/whoops could be catching the exception first.

Related

phpUnit test code that sets up error handler

I have some php code in a class that uses inheritance and requires and during that loading process, the error handler is setup. This interferes with my phpUnit test as it captures the exceptions/errors that phpUnit needs to run my tests. This is a large project and I can't just go change stuff. I can add stuff, though.
I cannot change the existing error handler code and as such I am looking for a way to make phpUnit be able to prevent the error handlers being called. I thought about overriding the call to set_error_handler, but this as expected gives the "cannot redeclare" error.
Currently I manually edit setup portion of the error handler by commenting the set_error_handler function call, but it would be nice if I could make this automatic without changing the source code (only changing the test code).
Is my problem clearly enough described?
Is what I need possible without adding runtime modules or changing the source code, i.e. just change the unittest php file?
Using php 5.5.

Unexpected error annotations everywhere since I installed version Oxygen

I installed the last version (Oxygen) of Eclipse for PHP. But now there are lots of error annotations that I think they shouldn't be.
Almost all of them have to do with Exception:
throw new Exception('Exception message');
The annotation message in the popup hint is like so:
Exception cannot be resolved to a type
And the hint offers me some quick fixes, which are using the Exception class declared in libraries imported with Composer.
Why is that? As far as I know, Exception is still an internal PHP class (no need to import it). I know I should be using more specific Exception classes, but for now, Exception works for me. And it shouldn't be marked as an error in Eclipse. Prior versions didn't detect this as an error. Furthermore the application runs without any problem.
Is this a bug? Otherwise, how do I disable this type of error annotation?
EDIT:
Another annoying issue happening is that the code assistant is not displaying any php internal function. Only functions, classes and methods declared in my app or in imported libraries. For instance, if I type:
str
the code assistant displays classes from Doctrine, Geocoder, etc, and imported functions like "strip_quotes", but nothing about strstr, str_pad, strpos, etc
Did you forgot about namespaces and PSR-4?
throw new \Exception('Exception message');
So when you are using a class which must be autoloaded, you must declare it via use or call it with full path (with namespace).
If you don`t want to write correct code and this message is annoying you, then I'm pretty sure that you can turn off this message via Eclipse configuration.

Laravel 5 - Add exceptions rendering logic from a package

I'm developing a package for Laravel 5 and I'd like to add the rendering logic of my own exceptions to the default ExceptionHandler.
I don't want to replace the default Laravel 5 exception handler, just want to let the application where my package is installed be aware of how my package exceptions should be rendered.
How can I do that? Thank you :)
If you wanted to replace the application exception handler, you could do so in your service provider. While it might be nice to extend from the application exception handler it would be difficult because it might not be named App\Excpetions\Handler if the developers have changed the application namespace.
$app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler',
'Vendor\Package\ExceptionHandler'
);
Otherwise, you might consider providing a trait that a developer can pull into their own ExceptionHandler and leverage your additional functionality that way.

Setter error with Laravel 4.2, HHVM, and Carbon

I'm trying to run an application on an HHVM 3.2 server and I'm getting a 'InvalidArgumentException Unknown setter '_date_time' error. It seems to have something to do with the magic functions. It also looks like it's coming from Carbon and due to the sessions being created.
I'm using Redis database for session management since I'm using HAPROXY for load balancing. Anyone else come across this issue and is there a fix?
Oddly I have another Laravel 4.2 (earlier version) application running on the same setup and it runs fine.
Here is the stack error:
InvalidArgumentException …/­vendor/­nesbot/­carbon/­src/­Carbon/­Carbon.php542
Carbon\Carbon __set <#unknown>0
DateTime __sleep <#unknown>0
serialize …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Store.php222
Illuminate\Session\Store save …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Middleware.php126
Illuminate\Session\Middleware closeSession …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Middleware.php79

Loading/dipping into CodeIgniter from Zend

I got hold of a dip into CI from CI forums and websites, which I have working. Basically; I have a fully working system in CodeIgniter, I have run tests that show a standard PHP file on the same server can access the classes and libraries that I made available.
One of the other legacy systems runs on Zend, and throws an exception when it incudes the CodeIgniter files. I can't get past:
$BM =& load_class('Benchmark', 'core');
in the dip file, with a long error being thrown by Zend. It throws (among much other information):
exception 'Zend_Exception' with message 'At least one error occurred including "Benchmark.php"; see includeErrors property'
Pretty much everything I can find on the internet finds ways to use the libraries from CodeIgniter, but that's the reverse of what I'm looking for. If I comment out the Benchmark loading, then it fails on Hooks, which leads me to believe that Zend has usurped or overloaded the load_class() function with its own, and is causing problems that way.
Has anybody gotten them working before?
I can't directly answer the question, but I just stumbled over a bit of rotting code referencing an Exception's "includeErrors" property.
After some search, I can maybe give a bit of context to what you observed.
Behaviour exists in some versions of ZF1 , see http://framework.zend.com/issues/browse/ZF-2463
if Zend_Loader includes a file
and the mere act of including it results in some PHP error (very often that will be E_STRICT if for example some inherited method signature doesnt match, or maybe if file is not found),
then it will throw an exception and add a "includeErrors" property to it

Categories