spatie / laravel-link-checker

Check all links in a Laravel application
https://murze.be/2015/11/a-package-to-check-all-links-in-a-laravel-app/
MIT License
259 stars 45 forks source link

Textual statuscode, but integer is expected #10

Closed juukie closed 7 years ago

juukie commented 7 years ago

Hey @freekmurze,

Using version 2.0 I crawled a link with an unresponsive host. The BaseReporter will assign it the statuscode Host did not respond in the hasBeenCrawled method:

$statusCode = $response ? $response->getStatusCode() : static::UNRESPONSIVE_HOST;

This exception will be thrown:

Type error: Argument 1 passed to Spatie\LinkChecker\Reporters\BaseReporter::isSuccessOrRedirect() must be of the type integer, string given, called in /var/www/vhosts/keizeryachts.com/httpdocs/vendor/s
  patie/laravel-link-checker/src/Reporters/LogBrokenLinks.php on line 36

I guess const UNRESPONSIVE_HOST = 'Host did not respond'; should be changed to a http status code?

freekmurze commented 7 years ago

Hi,

could you try the dev-master version and let me know if that fixes this issue for you?

juukie commented 7 years ago

Ah I see it has been fixed but it's unreleased. https://github.com/spatie/laravel-link-checker/commit/2c2969f8cda02715f069836289aa0dd058bbdb8e This will fix indeed! 👍 Thanks

freekmurze commented 7 years ago

The fix is now tagged. Upgrading to 1.0.3 fixes the problem.