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

invalid type to settype #3

Closed
decima opened this issue Aug 15, 2021 · 3 comments · Fixed by ory/sdk#122
Closed

invalid type to settype #3

decima opened this issue Aug 15, 2021 · 3 comments · Fixed by ory/sdk#122

Comments

@decima
Copy link

decima commented Aug 15, 2021

I'm working on implementing an UI for kratos with Symfony and I've got this error using php 8.0.8

ValueError:
settype(): Argument #2 ($type) must be a valid type

  at vendor/ory/kratos-client-php/lib/ObjectSerializer.php:335
  at settype()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:335)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:385)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:385)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:286)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:385)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/ObjectSerializer.php:385)
  at Ory\Kratos\Client\ObjectSerializer::deserialize()
     (vendor/ory/kratos-client-php/lib/Api/V0alpha1Api.php:2960)
  at Ory\Kratos\Client\Api\V0alpha1Api->getSelfServiceLoginFlowWithHttpInfo()
     (vendor/ory/kratos-client-php/lib/Api/V0alpha1Api.php:2903)
  at Ory\Kratos\Client\Api\V0alpha1Api->getSelfServiceLoginFlow()
     (src/Controller/AuthController.php:21)
  at App\Controller\AuthController->login()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:199)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:37)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:35)
  at require_once('/home/decima/Projects/perso2021/kratosUi/vendor/autoload_runtime.php')
     (public/index.php:5) 

Here is my code, maybe i'm doing something wrong:

    /**
     * @Route("/auth/login", name="auth_login")
     */
    public function login(Request $request, Kratos $kratos): Response
    {
        if (!$flowId = $request->query->get("flow")) {
            return $this->redirect($kratos->getBrowserUrl() . "/self-service/login/browser");
        }
        $result = $kratos->admin()->getSelfServiceLoginFlow($flowId, $request->headers->get("cookie"));
        return $this->render('auth/login.html.twig', [
            'ui' => $result->getUi(),
        ]);
    }

Due to new php 8 Consistent type errors for internal functions.
I rewrote my code to be php 7.4.22 compliant, and shutdown the warning :

$result = @$kratos->admin()->getSelfServiceLoginFlow($flowId, $request->headers->get("cookie"));

image

Is there a solution to use it with php 8.0?

@aeneasr
Copy link
Member

aeneasr commented Aug 15, 2021

Looks like this is a generator issue - we use openapi generator for generating this repo!

@NickUfer
Copy link

I provided a fix in the generator library as I ran into the same problem. Should be fixed with 5.3.0, the release is due on 18.10.2021.
OpenAPITools/openapi-generator#10576

@NickUfer
Copy link

NickUfer commented Oct 12, 2021

@aeneasr on 18.10 the generator should be re run with 5.3.0 even without any api changes to fix this problem asap 👍

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

Successfully merging a pull request may close this issue.

3 participants