Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the "Profiler" #10223

Closed
Gounlaf opened this issue Mar 11, 2019 · 19 comments
Closed

Issue with the "Profiler" #10223

Gounlaf opened this issue Mar 11, 2019 · 19 comments
Labels
DX Issues and PRs aimed at improving Developer eXperience. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.

Comments

@Gounlaf
Copy link

Gounlaf commented Mar 11, 2019

Sylius version affected: 1.4.1 (and probably 1.3.x)

Description
Got issue with the symfony/web-profiler-bundle: "An error occurred while loading the web debug toolbar, on a fresh install.

On a fresh install of Symfony with some "simple" entities, I don't have the issues.

For the "payload" below, the exact error was:

Notice: unserialize(): Error at offset 1345 of 2296 bytes

ErrorException
in vendor/symfony/http-kernel/DataCollector/DataCollector.php (line 53)
DataCollector->unserialize('a:3:{s:7:"channel";O:26:"App\\Entity\\Channel\\Channel":21:{s:15:"' . "\0" . '*' . "\0" . 'baseCurrency";O:28:"App\\Entity\\Currency\\Currency":4:{s:5:"' . "\0" . '*' . "\0" . 'id";i:1;s:7:"' . "\0" . '*' . "\0" . 'code";s:3:"EUR";s:12:"' . "\0" . '*' . "\0" . 'createdAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}s:12:"' . "\0" . '*' . "\0" . 'updatedAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}}s:16:"' . "\0" . '*' . "\0" . 'defaultLocale";O:24:"App\\Entity\\Locale\\Locale":4:{s:5:"' . "\0" . '*' . "\0" . 'id";i:1;s:7:"' . "\0" . '*' . "\0" . 'code";s:5:"en_US";s:12:"' . "\0" . '*' . "\0" . 'createdAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}s:12:"' . "\0" . '*' . "\0" . 'updatedAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}}s:17:"' . "\0" . '*' . "\0" . 'defaultTaxZone";N;s:25:"' . "\0" . '*' . "\0" . 'taxCalculationStrategy";s:17:"order_items_based";s:13:"' . "\0" . '*' . "\0" . 'currencies";O:33:"Doctrine\\ORM\\PersistentCollection":2:{s:13:"' . "\0" . '*' . "\0" . 'collection";O:43:"Doctrine\\Common\\Collections\\ArrayCollection":1:{s:53:"' . "\0" . 'Doctrine\\Common\\Collections\\ArrayCollection' . "\0" . 'elements";a:1:{i:0;r:29456;}}s:14:"' . "\0" . '*' . "\0" . 'initialized";b:1;}s:10:"' . "\0" . '*' . "\0" . 'locales";O:33:"Doctrine\\ORM\\PersistentCollection":2:{s:13:"' . "\0" . '*' . "\0" . 'collection";O:43:"Doctrine\\Common\\Collections\\ArrayCollection":1:{s:53:"' . "\0" . 'Doctrine\\Common\\Collections\\ArrayCollection' . "\0" . 'elements";a:1:{i:0;r:29467;}}s:14:"' . "\0" . '*' . "\0" . 'initialized";b:1;}s:12:"' . "\0" . '*' . "\0" . 'themeName";N;s:15:"' . "\0" . '*' . "\0" . 'contactEmail";N;s:30:"' . "\0" . '*' . "\0" . 'skippingShippingStepAllowed";b:0;s:29:"' . "\0" . '*' . "\0" . 'skippingPaymentStepAllowed";b:0;s:30:"' . "\0" . '*' . "\0" . 'accountVerificationRequired";b:1;s:18:"' . "\0" . '*' . "\0" . 'shopBillingData";O:58:"Proxies\\__CG__\\Sylius\\Component\\Core\\Model\\ShopBillingData":8:{s:17:"__isInitialized__";b:0;s:5:"' . "\0" . '*' . "\0" . 'id";i:1;s:10:"' . "\0" . '*' . "\0" . 'company";N;s:8:"' . "\0" . '*' . "\0" . 'taxId";N;s:14:"' . "\0" . '*' . "\0" . 'countryCode";N;s:9:"' . "\0" . '*' . "\0" . 'street";N;s:7:"' . "\0" . '*' . "\0" . 'city";N;s:11:"' . "\0" . '*' . "\0" . 'postcode";N;}s:5:"' . "\0" . '*' . "\0" . 'id";i:1;s:7:"' . "\0" . '*' . "\0" . 'code";s:7:"default";s:7:"' . "\0" . '*' . "\0" . 'name";s:7:"Default";s:14:"' . "\0" . '*' . "\0" . 'description";N;s:11:"' . "\0" . '*' . "\0" . 'hostname";N;s:8:"' . "\0" . '*' . "\0" . 'color";N;s:12:"' . "\0" . '*' . "\0" . 'createdAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}s:12:"' . "\0" . '*' . "\0" . 'updatedAt";O:8:"DateTime":3:{s:4:"date";s:26:"2019-03-11 19:56:33.000000";s:13:"timezone_type";i:3;s:8:"timezone";s:3:"UTC";}s:10:"' . "\0" . '*' . "\0" . 'enabled";b:1;}s:8:"channels";a:1:{i:0;r:29455;}s:22:"channel_change_support";b:1;}')
in vendor/symfony/http-kernel/Profiler/FileProfilerStorage.phpunserialize (line 285)
in vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php->createProfileFromData (line 122)
in vendor/symfony/http-kernel/Profiler/Profiler.php->read (line 86)
in vendor/symfony/web-profiler-bundle/Controller/ProfilerController.php->loadProfile (line 143)
in vendor/symfony/http-kernel/HttpKernel.php->toolbarAction (line 150)
in vendor/symfony/http-kernel/HttpKernel.php->handleRaw (line 67)
in vendor/symfony/http-kernel/Kernel.php->handle (line 198)
Kernel->handle(object(Request)) in public/index.php (line 25)
in /Users/gounlaf/.composer/vendor/laravel/valet/server.php require (line 158)

Steps to reproduce

  1. Do a fresh install
  2. Open the web application
  3. Notice that calls to web profiler produce errors 500.

Possible Solution

I don't know if it's related:

  • to the profiler itself
  • to the way Sylius declare/map Entities

Regards,

@Gounlaf Gounlaf changed the title Issue wuth the "Profiler" Issue with the "Profiler" Mar 11, 2019
@Zales0123 Zales0123 added the Potential Bug Potential bugs or bugfixes, that needs to be reproduced. label Mar 11, 2019
@Roshyo
Copy link
Contributor

Roshyo commented Mar 12, 2019

Are you under PHP 7.3 ?
I Believe it's more related to PHP 7.3 with Symfony 4.2 and unserialize() error. But I may be wrong.

@Gounlaf
Copy link
Author

Gounlaf commented Mar 12, 2019

Are you under PHP 7.3 ?

I have the problem on both 7.2 and 7.3

@pamil pamil added the DX Issues and PRs aimed at improving Developer eXperience. label Mar 19, 2019
@tchapi
Copy link
Contributor

tchapi commented Mar 21, 2019

Same problem here on 1.1.latest and PHP 7.3, 1.2.latest and PHP 7.3 (PHP 7.3.2 to be exact)

@vvasiloi
Copy link
Contributor

Probably related: symfony/symfony#29459
Looks like a PHP 7.3 bug.

@flixart33
Copy link

flixart33 commented Apr 2, 2019

I confirm error with sylius 1.3.7 and PHP 7.3

@migmolrod
Copy link

It seems like a bug in these PHP versions but from the PHP team the response was "it's something that we will fix in 7.4 since we're reworking Serialization, so nothing we can do in 7.3". So we must find some kind of workaround.

In my particular case, the debug toolbar only crashes when logged in. As the 'anon.' user, the bar works well. So I guess there is something in the User structure that causes toolbar to fail when it has to serialize/deserialize it. Either the User entity itself or some other entity with an ORM relation with User. Probably the latter if I understood well the messages from that issue in Symfony.

@fmarcoux96
Copy link

Is there a way to disable the collector in the meantime?

I have the same issue with SF 4.2.8, PHP 7.3.5 and Sylius 1.5.0.

@migmolrod
Copy link

I tried disabling the offending data_collector (in my case it seems to be sylius.channel_collector) redefining it in my own services.yml file with priority: 0 but no luck. Same error.
And this of course doesn't work either:

web_profiler:
    toolbar: true
    intercept_redirects: false

framework:
    profiler: { collect: false }

Because even if web_profiler.toolbar is true, the framework.profiler.collect set to false completely disables the toolbar.

@fmarcoux96
Copy link

I tried it too with the LoggerCollector, the CacheCollector and few more but nothing works.

Also, I can't keep the profiler bar too without the framework.profiler.collect parameter.

@p-carrillo
Copy link

p-carrillo commented May 27, 2019

Same Here, everything working fine on Sylius 1.3 and php 7.2, but not getting profiler to work on Sylius 1.4 and beyond. Using Symfony 3.4

@migmolrod
Copy link

@Chrysweel I'd open a new issue for that. Even tho your profiler is not working, the cause is completely different than in this issue, so I don't find it related to this one.

@thisismzm
Copy link

thisismzm commented Jun 14, 2019

I'm using Sylius 1.5.1. When I'm using PHP 7.3.6 I have this problem but when I'm using PHP 7.2 I don't have this problem.

@pamil
Copy link
Contributor

pamil commented Jun 25, 2019

I tried to reproduce it on my machine but without success. Could you provide the following data if you have experienced it:

  • PHP version (with patch version also, eg. 7.3.6, not 7.3)
  • Installed packages versions (output of composer show command)

To be extra sure, please do the following:

  • Update PHP to the latest supported version (7.3.6 or 7.2.19)
  • Update Symfony to the latest supported version (4.3.1, 4.2.9 or 3.4.28)
  • Update Sylius to the latest supported version (1.5.2 or 1.4.6)

@p-carrillo
Copy link

p-carrillo commented Jun 25, 2019

Hi Pamil,

Here is all the data requested, Php, Sylius and Symfony are in their latest versions. I'm also going to try to reproduce the issue from scratch, thanks for your time:

Php:

PHP 7.2.19 (cli) (built: Jun 17 2019 22:32:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

Composer Show:


aporat/store-receipt-validator                  2.2.0              PHP receipt validator for Apple iTunes, Google Play and Amazon App Store
aws/aws-sdk-php                                 3.100.8            AWS SDK for PHP - Use Amazon Web Services in your PHP project
behat/transliterator                            dev-master 826ce7e String transliterator
clue/stream-filter                              v1.4.1             A simple and modern approach to stream filtering in PHP
cocur/slugify                                   3.2.x-dev d41701e  Converts a string into a slug.
composer/ca-bundle                              dev-master 3a41bed Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
crevillo/payum-redsys                           dev-master c256c47 Redsys gateway
doctrine/annotations                            1.7.x-dev 3f35255  Docblock Annotations Parser
doctrine/cache                                  dev-master 17ec59c PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections                            dev-master c23e14f PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                                 dev-master 6bc33d1 PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces, proxies, event system...
doctrine/data-fixtures                          dev-master 8133b3f Data Fixtures for all Doctrine Object Managers
doctrine/dbal                                   2.9.x-dev 66f2811  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/doctrine-bundle                        dev-master eb068c2 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle                  dev-master c46725e Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle               v2.4.1             Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle             dev-master 2fa7e62 Symfony DoctrineMigrationsBundle
doctrine/event-manager                          dev-master e05ae70 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                              v1.3.0             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                           dev-master fb21dea A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                                  dev-master 975c0e4 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                             dev-master 0069f40 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very eas...
doctrine/orm                                    2.7.x-dev 9e73672  Object-Relational-Mapper for PHP
doctrine/persistence                            1.2.x-dev 43526ae  The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/reflection                             dev-master 4a97a22 The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allow...
egulias/email-validator                         2.1.8              A library for validating emails against several RFCs
eightpoints/guzzle-bundle                       v7.x-dev afb23b8   Integrates Guzzle into Symfony2, comes with WSSE Plugin for RESTful Interfaces
excelwebzone/recaptcha-bundle                   v1.5.13            This bundle provides easy reCAPTCHA form field integration
exsyst/swagger                                  v0.4.1             A php library to manipulate Swagger specifications
fig/link-util                                   dev-master 1a07821 Common utility implementations for HTTP links
firebase/php-jwt                                v5.0.0             A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
frequence-web/contact-bundle                    dev-master 2596e35 Event-based contact bundle
friendsofsymfony/oauth-server-bundle            1.6.x-dev fcaa25c  Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php                     dev-master b37dd31 OAuth2 library
friendsofsymfony/rest-bundle                    dev-master 4ba10cc This Bundle provides various tools to rapidly develop RESTful API's with Symfony
fzaninotto/faker                                dev-master fb218ad Faker is a PHP library that generates fake data for you.
gedmo/doctrine-extensions                       v2.4.x-dev e586c24 Doctrine2 behavioral extensions
google/apiclient                                dev-master 4bfd3ed Client library for Google APIs
google/apiclient-services                       v0.103             Client library for Google APIs
google/auth                                     v1.5.1             Google Auth Library for PHP
google/recaptcha                                dev-master b1b674a Client library for reCAPTCHA, a free service that protects websites from spam and abuse.
guzzlehttp/guzzle                               dev-master ca2892a Guzzle is a PHP HTTP client library
guzzlehttp/promises                             dev-master e6d006f Guzzle promises library
guzzlehttp/psr7                                 dev-master e113254 PSR-7 message implementation that also provides common utility methods
hamcrest/hamcrest-php                           dev-master c0436bf This is the PHP port of Hamcrest Matchers
imagine/imagine                                 0.7.x-dev b216ca7  Image processing for PHP 5.3
incenteev/composer-parameter-handler            dev-master 933c45a Composer script handling your ignored parameter file
jdorn/sql-formatter                             dev-master 7ef9b85 a PHP SQL highlighting library
jms/metadata                                    1.x-dev e5854ab    Class/method/property metadata management in PHP
jms/parser-lib                                  dev-master 6067cc6 A library for easily creating recursive-descent parsers.
jms/serializer                                  1.x-dev ee96d57    Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
jms/serializer-bundle                           2.x-dev 92ee808    Allows you to easily serialize, and deserialize data of any complexity
knplabs/gaufrette                               dev-master 350f0f6 PHP library that provides a filesystem abstraction layer
knplabs/knp-components                          dev-master 87d8f98 Knplabs component library
knplabs/knp-gaufrette-bundle                    v0.5.3             Allows to easily use the Gaufrette library in a Symfony project
knplabs/knp-menu                                dev-master a0d90bd An object oriented menu library
knplabs/knp-menu-bundle                         dev-master 2670275 This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle                    v2.8.0             Paginator bundle for Symfony to automate pagination and simplify sorting and other features
kylekatarnls/update-helper                      1.1.1              Update helper
lcobucci/jwt                                    3.3.x-dev a11ec5f  A simple library to work with JSON Web Token and JSON Web Signature
league/tactician                                v1.0.3             A small, flexible command bus. Handy for building service layers.
league/tactician-bundle                         v1.1.16            Bundle to integrate Tactician with Symfony projects
league/tactician-container                      2.0.0              Tactician integration for any container implementing PSR-11
league/tactician-doctrine                       v1.1.1             Plugins for Tactician commands using Doctrine, like wrapping every command in a transaction
league/tactician-logger                         v0.10.0            Adds PSR-3 logging support to the Tactician command bus
league/uri                                      5.3.0              URI manipulation library
league/uri-components                           1.x-dev d0412fd    URI components manipulation library
league/uri-hostname-parser                      1.1.1              ICANN base hostname parsing implemented in PHP.
league/uri-interfaces                           1.1.1              Common interface for URI representation
league/uri-manipulations                        dev-master a9092d2 URI manipulation library
league/uri-parser                               1.4.1              userland URI parser RFC 3986 compliant
league/uri-schemes                              1.2.1              URI manipulation library
lexik/jwt-authentication-bundle                 v2.5.4             This bundle provides JWT authentication for your Symfony REST API
lexik/maintenance-bundle                        v2.1.5             This bundle allows you to place your website in maintenance mode by calling two commands from your console.
liip/imagine-bundle                             2.1.0              This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.
maxbanton/cwh                                   v1.1.11            AWS CloudWatch Handler for Monolog library
michaelmoussa/doctrine-qbmocker                 0.12.0             A helper library for mocking Doctrine query builders
mockery/mockery                                 dev-master d0e6b4d Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                                 1.x-dev 4d5b7e6    Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                          2.4.0              Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy                               1.x-dev e6828ef    Create deep copies (clones) of your objects
namshi/jose                                     7.2.3              JSON Object Signing and Encryption library for PHP.
nelmio/api-doc-bundle                           v3.4.0             Generates documentation for your REST API from annotations
nelmio/cors-bundle                              dev-master 10a24c1 Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony2 application
nesbot/carbon                                   1.38.4             A simple API extension for DateTime.
ocramius/package-versions                       1.4.0              Composer plugin that provides efficient querying for installed package versions (no runtime IO)
ocramius/proxy-manager                          2.2.x-dev 14b137b  A library providing utilities to generate, instantiate and generally operate with Object Proxies
pagerfanta/pagerfanta                           v2.1.2             Pagination for PHP
paragonie/random_compat                         v2.0.18            PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
payum/iso4217                                   dev-master c1bee4b ISO 4217 PHP Library
payum/payum                                     dev-master cf4be4f One million downloads of Payum already! Payum offers everything you need to work with payments. Friendly for all PHP frameworks (Symfony, Laravel, Zend, Yii, Silex). Check more visiting site.
payum/payum-bundle                              dev-master 9669e1c One million downloads of Payum already! Payum offers everything you need to work with payments. Check more visiting site.
php-http/guzzle6-adapter                        v1.1.1             Guzzle 6 HTTP Adapter
php-http/httplug                                v1.1.0             HTTPlug, the HTTP client abstraction for PHP
php-http/message                                1.7.2              HTTP Message related tools
php-http/message-factory                        dev-master 597f30e Factory interfaces for PSR-7 HTTP Message
php-http/promise                                dev-master 1cc44dc Promise used for asynchronous HTTP requests
phpcollection/phpcollection                     0.5.0              General-Purpose Collection Library for PHP
phpdocumentor/reflection-common                 1.0.1              Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock               4.3.1              With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver                     0.4.0             
phpoption/phpoption                             1.5.0              Option Type for PHP
phpseclib/phpseclib                             2.0.x-dev d2085db  PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.
phpspec/prophecy                                dev-master 1927e75 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage                       4.0.x-dev ef7b2f5  Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator                       1.4.2              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template                       1.2.1              Simple template engine.
phpunit/php-timer                               1.0.x-dev 9513098  Utility class for timing
phpunit/php-token-stream                        2.0.x-dev 13eb9ab  Wrapper around PHP's tokenizer extension.
phpunit/phpunit                                 5.7.0              The PHP Unit Testing framework.
phpunit/phpunit-mock-objects                    3.4.x-dev a23b761  Mock Object library for PHPUnit
polishsymfonycommunity/symfony-mocker-container v1.0.2             Provides base Symfony dependency injection container enabling service mocking.
predis/predis                                   v1.1.x-dev 111d100 Flexible and feature-complete Redis client for PHP and HHVM
presta/sitemap-bundle                           v1.6.0             A Symfony bundle that provides tools to build your application sitemap.
psr/cache                                       dev-master 78c5a01 Common interface for caching libraries
psr/container                                   dev-master 014d250 Common Container Interface (PHP FIG PSR-11)
psr/http-message                                dev-master f6561bf Common interface for HTTP messages
psr/link                                        dev-master 131b5c3 Common interfaces for HTTP links
psr/log                                         dev-master c4421fc Common interface for logging libraries
psr/simple-cache                                dev-master 408d5ea Common interfaces for simple caching
ralouphie/getallheaders                         3.0.3              A polyfill for getallheaders.
ramsey/uuid                                     3.x-dev 4c467ce    Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).
robrichards/xmlseclibs                          3.0.3              A PHP library for XML Security
sebastian/code-unit-reverse-lookup              dev-master aa16919 Looks up which function or method a line of code belongs to
sebastian/comparator                            1.2.x-dev 18a5d97  Provides the functionality to compare PHP values for equality
sebastian/diff                                  1.4.x-dev 7f066a2  Diff implementation
sebastian/environment                           2.0.x-dev 5795ffe  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                              2.0.x-dev 5e8e306  Provides the functionality to export PHP variables for visualization
sebastian/global-state                          1.1.x-dev cea85a8  Snapshotting of global state
sebastian/object-enumerator                     2.0.x-dev c956fe7  Traverses array structures and object graphs to enumerate all referenced objects
sebastian/recursion-context                     2.0.x-dev 7e4d7c5  Provides functionality to recursively process PHP variables
sebastian/resource-operations                   1.0.0              Provides a list of PHP built-in functions that operate on resources
sebastian/version                               2.0.1              Library that helps with managing the version number of Git-hosted PHP projects
sensio/framework-extra-bundle                   v5.2.4             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle                         dev-master 28cbaa2 This bundle generates code for you
sensiolabs/security-checker                     v5.0.3             A security checker for your composer.lock
snc/redis-bundle                                2.1.x-dev 9ac8d92  A Redis bundle for Symfony
sonata-project/block-bundle                     3.x-dev 5b62fed    Symfony SonataBlockBundle
sonata-project/cache                            2.x-dev c81334f    Cache library
sonata-project/core-bundle                      3.17.0             Symfony SonataCoreBundle
sonata-project/datagrid-bundle                  2.x-dev d13faff    Symfony SonataDatagridBundle
sonata-project/doctrine-extensions              1.x-dev 5c9bfa6    Doctrine2 behavioral extensions
sonata-project/intl-bundle                      2.x-dev 8722cc1    Symfony SonataIntlBundle
stof/doctrine-extensions-bundle                 dev-master 9b47596 Integration of the gedmo/doctrine-extensions with Symfony2
swiftmailer/swiftmailer                         dev-master b22e508 Swiftmailer, free feature-rich PHP mailer
sylius-labs/association-hydrator                v1.1.1             Doctrine ORM hydration performance optimization made easier.
sylius/fixtures-bundle                          dev-master f7543ea Configurable fixtures for Symfony applications.
sylius/grid-bundle                              dev-master 1cbdbfa Amazing grids with support of filters and custom fields integrated into Symfony.
sylius/mailer-bundle                            dev-master 8efd82d Mailers and e-mail template management for Symfony projects.
sylius/registry                                 dev-master 0f3e6ca Services registry.
sylius/resource-bundle                          dev-master 2eb0c79 Resource component for Sylius.
sylius/shop-api-plugin                          v1.0.0-beta.21     Shop API for Sylius E-Commerce.
sylius/sylius                                   v1.5.2             E-Commerce platform for PHP, based on Symfony framework.
sylius/theme-bundle                             dev-master 0ca795b Themes management for Symfony projects.
symfony/contracts                               dev-master 3f3f796 A set of abstractions extracted out of the Symfony components
symfony/monolog-bundle                          dev-master 7fbecb3 Symfony MonologBundle
symfony/phpunit-bridge                          3.4.x-dev 520ecf1  Symfony PHPUnit Bridge
symfony/polyfill-apcu                           dev-master a502fac Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype                          dev-master 82ebae0 Symfony polyfill for ctype functions
symfony/polyfill-iconv                          dev-master f037ea2 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-icu                       v1.11.0            Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn                       v1.11.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring                       dev-master fe5e94c Symfony polyfill for the Mbstring extension
symfony/polyfill-php56                          dev-master f4dddbc Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70                          dev-master bc4858f Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-php72                          dev-master ab50dcf Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-util                           dev-master b46c6ca Symfony utilities for portability of PHP codes
symfony/psr-http-message-bridge                 dev-master 81ae86d PSR HTTP message bridge
symfony/swiftmailer-bundle                      dev-master cb125b3 Symfony SwiftmailerBundle
symfony/symfony                                 v3.4.28            The Symfony PHP framework
symfony/thanks                                  v1.1.0             Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)!
symfony/var-dumper                              4.4.x-dev 51e0fda  Symfony mechanism for exploring and dumping PHP variables
twig/extensions                                 dev-master 9aefd75 Common additional features for Twig that do not directly belong in core
twig/twig                                       v2.10.0            Twig, the flexible, fast, and secure template language for PHP
webmozart/assert                                1.4.0              Assertions to validate method input/output with nice error messages.
white-october/pagerfanta-bundle                 v1.2.4             Bundle to use Pagerfanta with Symfony2
willdurand/hateoas                              2.12.0             A PHP library to support implementing representations for HATEOAS REST web services
willdurand/hateoas-bundle                       1.4.0              Integration of Hateoas into Symfony2.
willdurand/jsonp-callback-validator             v1.1.0             JSONP callback validator.
willdurand/negotiation                          2.x-dev cf78c9a    Content Negotiation tools for PHP provided as a standalone library.
winzou/state-machine                            0.3.3              A very lightweight yet powerful PHP state machine
winzou/state-machine-bundle                     v0.3.1             Bundle for the very lightweight yet powerful PHP state machine
zendframework/zend-code                         3.3.x-dev 8003f74  Extensions to the PHP Reflection API, static code scanning, and code generation
zendframework/zend-diactoros                    1.8.x-dev 1dc4959  PSR HTTP Message implementations
zendframework/zend-hydrator                     2.4.x-dev 9c48e07  Serialize objects to arrays, and vice versa
zendframework/zend-stdlib                       3.3.x-dev 519a966  SPL extensions, array utilities, error handlers, and more
zircote/swagger-php                             2.x-dev f2a00f2    Swagger-PHP - Generate interactive documentation for your RESTful API using phpdoc annotations

@p-carrillo
Copy link

I found that in my case the issue comes from a Sylius Channel Query deprecation log trying to be sanitized.

this is the query:

SELECT t0.code AS code_1, t0.name AS name_2, t0.color AS color_3, t0.description AS description_4, t0.enabled AS enabled_5, t0.hostname AS hostname_6, t0.created_at AS created_at_7, t0.updated_at AS updated_at_8, t0.id AS id_9, t0.theme_name AS theme_name_10, t0.tax_calculation_strategy AS tax_calculation_strategy_11, t0.contact_email AS contact_email_12, t0.skipping_shipping_step_allowed AS skipping_shipping_step_allowed_13, t0.skipping_payment_step_allowed AS skipping_payment_step_allowed_14, t0.account_verification_required AS account_verification_required_15, t0.shop_billing_data_id AS shop_billing_data_id_16, t0.default_locale_id AS default_locale_id_17, t18.code AS code_19, t18.created_at AS created_at_20, t18.updated_at AS updated_at_21, t18.id AS id_22, t0.base_currency_id AS base_currency_id_23, t24.code AS code_25, t24.created_at AS created_at_26, t24.updated_at AS updated_at_27, t24.id AS id_28, t0.default_tax_zone_id AS default_tax_zone_id_29 FROM sylius_channel t0 INNER JOIN sylius_locale t18 ON t0.default_locale_id = t18.id INNER JOIN sylius_currency t24 ON t0.base_currency_id = t24.id WHERE t0.code = ? LIMIT 1

In loggerDataCollector class, sanitizeLogs method tries to count exceptions and save the result to errorcount key on the array, and profiler crashes as this key does not exist.

The error is triggered in ArrayNode.php class, line 242:

Symfony\Component\Debug\Exception\SilencedErrorContext Object
(
    [count] => 1
    [severity:Symfony\Component\Debug\Exception\SilencedErrorContext:private] => 16384
    [file:Symfony\Component\Debug\Exception\SilencedErrorContext:private] => /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php
    [line:Symfony\Component\Debug\Exception\SilencedErrorContext:private] => 242
    [trace:Symfony\Component\Debug\Exception\SilencedErrorContext:private] => Array
        (
            [0] => Array
                (
                    [file] => /var/www/html/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php
                    [line] => 309
                    [function] => finalizeValue
                    [class] => Symfony\Component\Config\Definition\ArrayNode
                    [type] => ->
                )

        )

)

And that's as far as I can go for now. The error may be not related to Sylius, but with all the vendors and externals loaded in my project, this query log is the only one that produces the issue.

private function sanitizeLogs($logs)
    {
        $sanitizedLogs = [];
        $silencedLogs = [];

        foreach ($logs as $log) {
            if (!$this->isSilencedOrDeprecationErrorLog($log)) {
                $sanitizedLogs[] = $log;

                continue;
            }

            $message = $log['message'];
            $exception = $log['context']['exception'];

            if ($exception instanceof SilencedErrorContext) {
                if (isset($silencedLogs[$h = spl_object_hash($exception)])) {
                    continue;
                }
                $silencedLogs[$h] = true;

                if (!isset($sanitizedLogs[$message])) {
                    $sanitizedLogs[$message] = $log + [
                        'errorCount' => 0,
                        'scream' => true,
                    ];
                }

               $sanitizedLogs[$message]['errorCount'] += $exception->count;

                continue;
            }

            $errorId = md5("{$exception->getSeverity()}/{$exception->getLine()}/{$exception->getFile()}\0{$message}", true);

            if (isset($sanitizedLogs[$errorId])) {
                ++$sanitizedLogs[$errorId]['errorCount'];
            } else {
                $log += [
                    'errorCount' => 1,
                    'scream' => false,
                ];

                $sanitizedLogs[$errorId] = $log;
            }
        }

        return array_values($sanitizedLogs);
    }

@jdeveloper
Copy link
Contributor

The problem is due to a deprecated config, but we do not know. I was digging with @Krleza the logs dumping (doctrine loggin and profeling set to false) those we think are critical and we discovered it has to do with a numeric message due to config

private function sanitizeLogs($logs)
    {
        $sanitizedLogs = [];
        $silencedLogs = [];

        foreach ($logs as $log) {
            if (!$this->isSilencedOrDeprecationErrorLog($log)) {
                $sanitizedLogs[] = $log;

                continue;
            }

            $message = $log['message'];
            $exception = $log['context']['exception'];

            if ($exception instanceof SilencedErrorContext) {
                if (isset($silencedLogs[$h = spl_object_hash($exception)])) {
                    continue;
                }
                $silencedLogs[$h] = true;

                if (!isset($sanitizedLogs[$message])) {
                    $sanitizedLogs[$message] = $log + [
                        'errorCount' => 0,
                        'scream' => true,
                    ];
                }

                if(!is_numeric($message)){
                    $sanitizedLogs[$message]['errorCount'] += $exception->count;
                }else{
                    dump([$message, $log, $sanitizedLogs[$message]]);
                }

                continue;
            }

            $errorId = md5("{$exception->getSeverity()}/{$exception->getLine()}/{$exception->getFile()}\0{$message}", true);

            if (isset($sanitizedLogs[$errorId])) {
                ++$sanitizedLogs[$errorId]['errorCount'];
            } else {
                $log += [
                    'errorCount' => 1,
                    'scream' => false,
                ];

                $sanitizedLogs[$errorId] = $log;
            }
        }

        return array_values($sanitizedLogs);
    }

And the dump is as follows

dump

Index 0 is the message,
Index 1 is the current log to sanatize
Index 2 is the previous log sanatized (not a SilencedErrorContext)

We hope it helps

@jdeveloper
Copy link
Contributor

jdeveloper commented Jul 2, 2019

We discovered that we had a deprecated config of sylius_mailer.

So we changed the following config

sylius_mailer:
    sender:
        name: "%app_email_name%"
        address: "%app_email_address%"
    templates: # Your templates available for selection in backend!
              shipment_mail_template: "email/ecommerce/shipment/shipment_mail.html.twig"
    emails:
        shipment_confirmation:
            template: "email/ecommerce/shipment/shipment_mail.html.twig"

to

sylius_mailer:
    sender:
        name: "%app_email_name%"
        address: "%app_email_address%"
    emails:
        shipment_confirmation:
            template: "email/ecommerce/shipment/shipment_mail.html.twig"

And it works now. We hope other people here can review their config and make the profiler work again

@fmarcoux96
Copy link

We discovered that we had a deprecated config of sylius_mailer.

So we changed the following config

sylius_mailer:
    sender:
        name: "%app_email_name%"
        address: "%app_email_address%"
    templates: # Your templates available for selection in backend!
              shipment_mail_template: "email/ecommerce/shipment/shipment_mail.html.twig"
    emails:
        shipment_confirmation:
            template: "email/ecommerce/shipment/shipment_mail.html.twig"

to

sylius_mailer:
    sender:
        name: "%app_email_name%"
        address: "%app_email_address%"
    emails:
        shipment_confirmation:
            template: "email/ecommerce/shipment/shipment_mail.html.twig"

And it works now. We hope other people here can review their config and make the profiler work again

Will this be modified in a PR?

@ostrolucky
Copy link
Contributor

See #10680

@pamil pamil closed this as completed in f8ac6c9 Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues and PRs aimed at improving Developer eXperience. Potential Bug Potential bugs or bugfixes, that needs to be reproduced.
Projects
None yet
Development

No branches or pull requests