sonata-project / SonataBlockBundle

Symfony SonataBlockBundle
https://docs.sonata-project.org/projects/SonataBlockBundle
MIT License
413 stars 141 forks source link

With a twig error, blocks profiler KO Notice: unserialize(): Error at offset #652

Closed cbastienbaron closed 4 years ago

cbastienbaron commented 4 years ago

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/block-bundle        3.18.1 3.18.1 Symfony SonataBlockBundle
sonata-project/cache               1.1.1  2.0.1  Cache library
sonata-project/cache-bundle        2.4.2  3.1.0  This bundle provides caching services
sonata-project/core-bundle         3.17.0 3.17.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle     2.5.0  3.0.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.3.1  1.3.1  Doctrine2 behavioral extensions
sonata-project/easy-extends-bundle 2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter            2.0.1  2.0.1  Lightweight Exporter library
sonata-project/media-bundle        3.21.0 3.21.0 Symfony SonataMediaBundle
sonata-project/notification-bundle 3.6.2  3.6.2  Symfony SonataNotificationBundle
sonata-project/seo-bundle          2.8.0  2.8.0  Symfony SonataSeoBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/assetic-bundle        v2.8.2  v2.8.2  Integrates Assetic into Symfony2
Package symfony/assetic-bundle is abandoned, you should avoid using it. Use symfony/webpack-encore-pack instead.
symfony/http-client           v4.3.6  v4.3.8  Symfony HttpClient component
symfony/http-client-contracts v1.1.7  v2.0.0  Generic abstractions related to HTTP clients
symfony/mime                  v4.3.6  v4.3.8  A library to manipulate MIME messages
symfony/monolog-bundle        v3.4.0  v3.5.0  Symfony MonologBundle
symfony/phpunit-bridge        v2.8.50 v4.3.8  Symfony PHPUnit Bridge
symfony/polyfill-apcu         v1.12.0 v1.12.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype        v1.12.0 v1.12.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu     v1.12.0 v1.12.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn     v1.12.0 v1.12.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring     v1.12.0 v1.12.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56        v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70        v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72        v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73        v1.12.0 v1.12.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-util         v1.12.0 v1.12.0 Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle    v2.6.7  v3.3.1  Symfony SwiftmailerBundle
symfony/symfony               v3.4.33 v4.3.8  The Symfony PHP framewor

twig/extensions                      v1.5.4             Common additional features for Twig that do not directly belong in core
twig/twig                            v2.12.1            Twig, the flexible, fast, and secure template language for PHP

PHP version

$ php -v
PHP 7.3.11-1+0~20191026.48+debian8~1.gbpf71ca0 (cli) (built: Oct 26 2019 15:48:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.11-1+0~20191026.48+debian8~1.gbpf71ca0, Copyright (c) 1999-2018, by Zend Technologies

Subject

When there is a twig error, an error occured when the profiler is retrieving data from blocks.

Steps to reproduce

generate a random twig error, undefined variable for example {{ noExist }}

Expected results

Get information about Sonata blocks from the page in the profiler.

Actual results

http://awesome.app/app_dev.php/_profiler/d6e0ef is in error (500)

Notice: unserialize(): Error at offset 9295 of 70645 bytes

when i comment https://github.com/sonata-project/SonataBlockBundle/blob/3.x/src/Profiler/DataCollector/BlockDataCollector.php#L53

profiler is ok

I guess it's link to php serialization https://wiki.php.net/rfc/custom_object_serialization

Someone has a clue ? tips / tricks ?

Thanks, Sébastien

core23 commented 4 years ago

Can you provide a PR with a bugfix @cbastienbaron ?

vsilvestre-accenture commented 4 years ago

Same issue here, I have no clue of the actual problem and how to solve it

franmomu commented 4 years ago

I guess it's related with https://github.com/sonata-project/SonataBlockBundle/issues/556

stale[bot] commented 4 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.