dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

Problem with "shouldReport" #1631

Closed ijokitalo closed 5 years ago

ijokitalo commented 5 years ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 5.8
Package version 2.0.*
PHP version 7.1.*

Actual Behaviour

When installing package 1.0.0 to 2.0-alfa or what so ever version then during optimization of autoload files composer gives:

PHP Fatal error: Class Dingo\Api\Exception\Handler contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Debug\ExceptionHandler::shouldReport) in /Users/ismo/Code/acfakta_org/vendor/dingo/api/src/Exception/Handler.php on line 16

Same happens when doing php artisan serve after the installation.

Expected Behaviour

Composer and Artisan to finish wo errors.

Steps to Reproduce

Install DIngo version 1.0. - 2.0. in system with: -PHP 7.1.* -Laravel 5.8

composer update -> error php artisan serve ->error

Possible Solutions

Add empty function shouldReport into your /vendor/dingo/api/src/Exception/Handler.php

public function shouldReport(Exception $e)
{
    //
}

This will make Laravel happy but I doubt that it is the correct fix.

Maybe it is my mistake. In that case please guide me.

Cheers

-Ismo

specialtactics commented 5 years ago

Hi @ijokitalo please update the package version, should be 2.1 now.

ijokitalo commented 5 years ago

Hi Max!

Unfortunately updating the package to 2.1 version didn't fix the issue.

I needed to drop Dingo Api from the project on time being.

Thanks for your reply and efforts.

Cheers

-- -Ismo

On Tue, Mar 5, 2019 at 1:13 AM Max notifications@github.com wrote:

Closed #1631 https://github.com/dingo/api/issues/1631.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dingo/api/issues/1631#event-2179401377, or mute the thread https://github.com/notifications/unsubscribe-auth/AIk-sF9BV2Vm4hpaTNlQuXYhcwUE1Vngks5vTaihgaJpZM4bcfHv .

-- -Ismo

ejancorp commented 5 years ago

I confirm this happened to me also for laravel/lumen 5.8, I tested on 5.7 and it's working fine.

specialtactics commented 5 years ago

@ijokitalo How certain are you? Can you please pastebin your composer.json and composer.lock files?

@ejancorp can you also please update the dingo package?

SOSTheBlack commented 5 years ago

update the package version (Y) "dingo/api": "^2.1",

ijokitalo commented 5 years ago

Hi Max,

rather certain because the composer was simply whining about the missing function's implementation and silenced when I brutally added the missing function.

I have been using Dingo earlier in some other projects and I loved it. Now there seems to be some irks that I cannot comprehend.

Another issue that I noticed that Dingo was messing up the web routing which I found really very unreal.

I can do some reinstallation and testing next weekend and report back to you.

I do not want waste the bandwith of the other list users so if you would like have the fore mentioned feedback please send a message to ijokitalo@gmail.com and we'll do this offline.

Cheers

-Ismo

On Tue, Mar 12, 2019 at 3:27 AM Max notifications@github.com wrote:

@ijokitalo https://github.com/ijokitalo How certain are you? Can you please pastebin your composer.json and composer.lock files?

@ejancorp https://github.com/ejancorp can you also please update the dingo package?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dingo/api/issues/1631#issuecomment-471809703, or mute the thread https://github.com/notifications/unsubscribe-auth/AIk-sOKW8vQICc0B8-oGDRySUT7orFQEks5vVwJzgaJpZM4bcfHv .

-- -Ismo

ijokitalo commented 5 years ago

update the package version (Y) "dingo/api": "^2.1",

Nope Jean it did't work as far I remember. But as said I try these over the weekend.

specialtactics commented 5 years ago

@ijokitalo Sure, though I think it's appropriate to keep it here all in one place rather than by email, please feel free to report your findings here.

If you are using the latest tag of Dingo, the file /vendor/dingo/api/src/Exception/Handler.php should have the following inside it:

    /**
     * Determine if the exception should be reported.
     *
     * @param  \Exception  $e
     *
     * @return bool
     */
    public function shouldReport(Exception $e)
    {
        return true;
    }

So if you fixed the problem by adding it, that means it wasn't there, and I would suggest the only way that's possible is if for some reason you are not actually using the latest vesion of Dingo.

It may be because there are some conflicting dependencies in your composer file, so this is why I suggest that if anyone is having this problem, please attach your composer.json and composer.lock files, so we can clearly see what version is being used.