Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array key exist issue #23

Closed
timersys opened this issue Jul 24, 2018 · 2 comments
Closed

Array key exist issue #23

timersys opened this issue Jul 24, 2018 · 2 comments
Assignees
Labels

Comments

@timersys
Copy link

[2018-07-23 21:00:17] local.ERROR: ErrorException: array_key_exists() expects parameter 2 to be array, string given in //vendor/slicingdice/slicingdice/src/Exceptions/SlicingDiceException.php:8 Stack trace: #0 //vendor/sentry/sentry/lib/Raven/Breadcrumbs/ErrorHandler.php(34): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'array_key_exist...', '/...', 8, Array) #1 [internal function]: Raven_Breadcrumbs_ErrorHandler->handleError(2, 'array_key_exist...', '/...', 8, Array) #2 //vendor/slicingdice/slicingdice/src/Exceptions/SlicingDiceException.php(8): array_key_exists('code', 'HTTP Error: 404') #3 //vendor/slicingdice/slicingdice/src/Exceptions/SlicingDiceHTTPException.php(10): Slicer\Exceptions\SlicingDiceException->__construct('HTTP Error: 404') #4 //vendor/slicingdice/slicingdice/src/Core/Requester.php(116): Slicer\Exceptions\SlicingDiceHTTPException->__construct('HTTP Error: 404') #5 //vendor/slicingdice/slicingdice/src/Core/Requester.php(102): Slicer\Core\Requester->wrapperRequests()

@timersys
Copy link
Author

timersys commented Jul 24, 2018

Sorry was a bit hurry yesterday. Basically error is coming slicingdice/slicingdice/src/Core/Requester.php:116
throw new SlicingDiceHTTPException("HTTP Error: " . $httpStatus);

Construct function in slicingdice/slicingdice/src/Exceptions/SlicingDiceException.php should be:

    public function __construct($data) {
        if( ! is_array($data) ) {
	        parent::__construct( $data );
        } else {
	        if (array_key_exists('code', $data)) {
		        $this->code = $data['code'];
	        }
	        if (array_key_exists('more-info', $data)) {
		        $this->more_info = $data['more-info'];
	        }
	        if (array_key_exists('message', $data)) {
		        parent::__construct($data['message']);
	        }
        }

    }

@joaosimbiose
Copy link
Member

Hi @timersys, thank you very much for reporting the issue, I'll open a PR to correct it ASAP if you come across any other issue feel free to let us know.

@joaosimbiose joaosimbiose self-assigned this Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants