applitools / eyes.sdk.php

Applitools Eyes PHP SDK
8 stars 9 forks source link

TypeError with ICheckSettingsInternal #34

Open elieux opened 5 years ago

elieux commented 5 years ago

Composer package applitools/eyes.sdk.php at v1.3.0 shows an error. Seems like null is passed where a settings object is expected. PHP v7.2.12.

PHP Fatal error:  Uncaught TypeError: Argument 6 passed to Applitools\MatchWindowTask::matchWindow() must be an instance of Applitools\fluent\ICheckSettingsInternal, null given, called in ~\vendor\applitools\eyes.sdk.php\eyes.sdk.php\EyesBase.php on line 1414 and defined in ~\vendor\applitools\eyes.sdk.php\eyes.sdk.php\MatchWindowTask.php:115

Source code:

<?php

require_once('vendor/autoload.php');

use Applitools\Images\Eyes;
use Applitools\RectangleSize;
use Applitools\PrintLogHandler;

$eyes = new Eyes();
$eyes->setApiKey('...');
$eyes->setLogHandler(new PrintLogHandler(true));
$eyes->open('...', '...', new RectangleSize(..., ...));
$eyes->checkImage(..., '...');
$eyes->close();

My quickfix was to change EyesBase.php on line 1398 from:

$checkSettingsInternal = null;

to

$checkSettingsInternal = new CheckSettings();
djdevin commented 5 years ago

Same issue, fix worked but I had to use $checkSettingsInternal = new fluent\CheckSettings();

svwu commented 5 years ago

Have the same issue, please fix!

svwu commented 5 years ago

I created a PullRequest as we really need this fix