|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80382 function():object{} cannot return a stdclass instance
Submitted: 2020-11-19 10:21 UTC Modified: 2020-11-19 16:01 UTC
From: 982144218 at qq dot com Assigned: sjon (profile)
Status: Closed Package: *Programming Data Structures
PHP Version: 7.1.9 OS: Win 10
Private report: No CVE-ID: None
 [2020-11-19 10:21 UTC] 982144218 at qq dot com
public static function decodeIdentityToken(string $identityToken) : object {
        $publicKeyKid = JWT::getPublicKeyKid($identityToken);

        $publicKeyData = self::fetchPublicKey($publicKeyKid);

        $publicKey = $publicKeyData['publicKey'];
        $alg = $publicKeyData['alg'];

        $payload = JWT::decode($identityToken, $publicKey, [$alg]);

        return $payload;

Test script:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-19 10:37 UTC]
-Status: Open +Status: Feedback
 [2020-11-19 10:37 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

If it is about the `: object` return type: yes, this is only
available as of PHP 7.2.0:
 [2020-11-19 10:41 UTC]
-Status: Feedback +Status: Spam
 [2020-11-19 15:50 UTC]
-Summary: 返回值问题 +Summary: Hidden because of SPAM -Status: Spam +Status: Re-Opened
 [2020-11-19 16:01 UTC]
-Summary: Hidden because of SPAM +Summary: function():object{} cannot return a stdclass instance -Status: Re-Opened +Status: Closed -PHP Version: 7.2.34 +PHP Version: 7.1.9 -Assigned To: +Assigned To: sjon
 [2020-11-19 16:01 UTC]
See for a simplified testcase. This is a known issue, the "object type annotation" was added in 7.2

As you can see here: PHP 7.1 is End Of Life, meaning it no longer receives updates. I suggest you update to PHP 7.2
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 10:01:31 2024 UTC