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

[issue] Exakat fails to generate report - PHP Fatal Error: Uncaught Error: Return value must be instance Brightzone\GremlinDriver\mixed, array returned #154

Open
eapostol opened this issue Dec 6, 2021 · 2 comments

Comments

@eapostol
Copy link

eapostol commented Dec 6, 2021

Expected Behavior

  • running exakat to generate sample audit php exakat.phar project -p sculpin after installing / configuring should generate a sample report in projects (name of project) folder

Current Behavior

  • exakat fails to generate a sample audit, file php_error.log returns the following error:

[06-Dec-2021 00:16:26 America/New_York] PHP Fatal error: Uncaught TypeError: Return value of Brightzone\GremlinDriver\RequestMessage::jsonSerialize() must be an instance of Brightzone\GremlinDriver\mixed, array returned in phar:///sample/user/exakat/exakat.phar/vendor/brightzone/gremlin-php/src/RequestMessage.php:60

Possible Solution
Replace the jsonSerialize() method and remove the :mixed from the signature (or the equiv. if possible to 'any')

`

/**
* The json serialize method
*
* @return mixed
* */
public function jsonSerialize():mixed
{
return $this->getData();
}

`
becomes

`

/**
* The json serialize method
*/
public function jsonSerialize()
{
return $this->getData();
}

`

and repackage the .phar file

Steps to Reproduce

  1. Follow full installation steps to install exakat for Ubuntu 20+
  2. Follow instructions for debian/ubuntu installation with Tinkergraph 3.4.9
  3. init sample project php exakat.phar init -p sculpin -R https://github.com/sculpin/sculpin
  4. run audit with php exakat.phar project -p sculpin

Context (Environment)

  • Ubuntu 20+
  • PHP 7.4.26
  • followed instructions from exakat documentation to install exakat. No issues encountered per se.
  • Caveat: Using openJDK 1.8 vs. Oracle Java JDK but that really should not be a difference in this issue afaik

Full stack trace is shown

[06-Dec-2021 00:16:26 America/New_York] PHP Fatal error: Uncaught TypeError: Return value of Brightzone\GremlinDriver\RequestMessage::jsonSerialize() must be an instance of Brightzone\GremlinDriver\mixed, array returned in phar:///x/iy/exakat/exakat.phar/vendor/brightzone/gremlin-php/src/RequestMessage.php:60

Stack trace:
#0 phar:///home/x/exakat-ubuntu/exakat.phar/library/Exakat/Graph/Helpers/GraphsonV3.php(306): Brightzone\GremlinDriver\RequestMessage->jsonSerialize()
#1 phar:///home/x/exakat/exakat.phar/library/Exakat/Graph/Helpers/GraphsonV3.php(144): Exakat\Graph\Helpers\GraphsonV3->convertObject()
#2 phar:///home/x/exakat/exakat.phar/library/Exakat/Graph/Helpers/GraphsonV3.php(84): Exakat\Graph\Helpers\GraphsonV3->convert()
#3 phar:///home/x/exakat/exakat.phar/vendor/brightzone/gremlin-php/src/Message.php(189): Exakat\Graph\Helpers\GraphsonV3->serialize()
#4 phar:///home/x/exakat/exakat.phar/vendor/brightzone/gremlin-php/src/Connection.php(184): Brightzone\GremlinDriver in phar:///home/x/exakat/exakat.phar/vendor/brightzone/gremlin-php/src/RequestMessage.php on line 60

@chogberg
Copy link

This makes it strict only php 8+ compatible as well if I understand it correctly: https://www.php.net/manual/en/language.types.declarations.php#language.types.declarations.mixed

@exakat
Copy link
Owner

exakat commented Jan 19, 2022

Indeed, though it should be PHP 7.4 compatible (still) at the engine level.

@eapostol : which version of Exakat are you using ATM?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants