Skip to content

Invalid data for JSON encoding leads to blank page #128

@aleho

Description

@aleho

Using json_encode without JSON_THROW_ON_ERROR masks invalid JSON data. This in turn leads to invalid JS being generated (opstate: ,) and a blank page. For me the data is invalid because of the error Inf and NaN cannot be JSON encoded.

Improving encoding with flags, e.g., json_encode($opcache->getData(), JSON_THROW_ON_ERROR | JSON_PARTIAL_OUTPUT_ON_ERROR), finally works.

A big problem here (FrankenPHP) seems to be that opcache_get_configuration() doesn't make a lot of sense, $config['directives'['opcache.memory_consumption'] seems to always report 0 for example.

Probably related: php/php-src#16927

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions