Skip to content

Fatal error: Unsupported operand types in ResourceCaster::castStream #23151

@VadimKulagin

Description

@VadimKulagin
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.2

I have the following standard logging configuration for dev environment:

monolog:
    handlers:
        main:
            type: stream
            path: '%kernel.logs_dir%/%kernel.environment%.log'
            level: debug
            channels: ['!event']
        console:
            type:   console
            process_psr_3_messages: false
            channels: ['!event', '!doctrine', '!console']
        server_log:
            type:   server_log
            process_psr_3_messages: false
            host: 127.0.0.1:9911

I found the problem that when a 500th error occurs (because of the PHP Fatal error – Call to a member function getCategory() on null), the web debug toolbar is not loaded, and then pop-up appears with the text: "An error occurred while loading the web debug toolbar (404: Not Found)".

In the error log, I found that another fatal error occurs in the ResourceCaster::castStream method:

Unsupported operand types in .../vendor/symfony/symfony/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php on line 44

Here's the code snippet that leads to the error:

$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);

I think that it is worth doing the validation of the value of $a and the result of castStreamContext before adding them to solve this problem. How do you think?

My logs here:
error.txt

And, by the way, if you pay attention to the logs, you can find another problem:

Warning:  call_user_func() expects parameter 1 to be a valid callback, cannot access private method Symfony\Bridge\Monolog\Handler\ServerLogHandler::nullErrorHandler() in .../vendor/symfony/symfony/src/Symfony/Component/VarDumper/Cloner/AbstractCloner.php on line 205

I think the nullErrorHandler method should be public.

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