Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] [DataCollector] Avoid Catchable Fatal Error: Object of class __PHP_Incomplete_Class could not be converted to string #17586

Copy link
Copy link
Closed
@yceruto

Description

@yceruto
Issue body actions

While the user doesn't delete the session data or clear cache of the browser, this exception occurrs when I access to panel profile > "Request/Response" > tab "Session" > "Session Attributes" and exists a serialized object (in session) whose class doesn't exist. Here has threw the exception:

//Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter.php line #76
return (string) $value; //instance of __PHP_Incomplete_Class

Since in these cases is_object will return false, I propose to add the following code to avoid the exception and display a readable value to the user:

// Special case of object
if ($value instanceof \__PHP_Incomplete_Class) {
    $array = new \ArrayObject($value);

    return sprintf('__PHP_Incomplete_Class(%s)', $array['__PHP_Incomplete_Class_Name']);
}

Result:

Session Attributes

Attribute Value
name __PHP_Incomplete_Class(AppBundle\Model\DeletedClass)

If they agree, I can create a PR to fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.