sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
449 stars 496 forks source link

images dont render #2232

Closed dima-gr closed 2 years ago

dima-gr commented 2 years ago

Today i make composer upgrade and after that images disappeared. When i dump media object i get

Proxies\__CG__\App\Entity\Media\SonataMediaMedia {#19025 ▼
  +__isInitialized__: false
  #id: 8
  #name: null
  #description: null
  #enabled: false
  #providerName: null
  #providerStatus: null
  #providerReference: null
  #providerMetadata: []
  #width: null
  #height: null
  #length: null
  #copyright: null
  #authorName: null
  #context: null
  #cdnStatus: null
  #cdnIsFlushable: false
  #cdnFlushIdentifier: null
  #cdnFlushAt: null
  #updatedAt: null
  #createdAt: null
  #binaryContent: null
  #previousProviderReference: null
  #contentType: null
  #size: null
  #category: null
   …2
}

And if i tried to upload image i get 'error.image_too_small' media-bundle version - 4.0.0-RC2

jordisala1991 commented 2 years ago

Did you find the source of the problem? I can't reproduce it. Mind to share more details about it (configuration, lower version in which the bug appears, the code that produces the bug...)?

dima-gr commented 2 years ago

trying to solve the problem. noticed that imagick is not installed in the environment. i am using docker php 8 and symfony 5.4

dima-gr commented 2 years ago

the problem was solved by downgrading to 4.0.0-alpha1. The problem appeared since version 4.0.0-RC1.

php version

PHP 8.0.11 (cli) (built: Oct 14 2021 22:36:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies
    with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans

composer show -i

beberlei/doctrineextensions              v1.3.0       A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
behat/transliterator                     v1.3.0       String transliterator
composer/package-versions-deprecated     1.11.99.4    Composer plugin that provides efficient querying for installed package versions (no runtime IO)
doctrine/annotations                     1.13.2       Docblock Annotations Parser
doctrine/cache                           2.1.1        PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and...
doctrine/collections                     1.6.8        PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                          3.2.0        PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better refle...
doctrine/dbal                            3.2.0        Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations                    v0.5.3       A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packa...
doctrine/doctrine-bundle                 2.5.2        Symfony DoctrineBundle
doctrine/doctrine-migrations-bundle      3.2.1        Symfony DoctrineMigrationsBundle
doctrine/event-manager                   1.1.1        The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                       2.0.4        PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of...
doctrine/instantiator                    1.4.0        A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                           1.2.1        PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                      3.3.2        PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database...
doctrine/orm                             2.10.3       Object-Relational-Mapper for PHP
doctrine/persistence                     2.2.3        The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter                   1.1.2        a PHP SQL highlighting library
egulias/email-validator                  3.1.2        A library for validating emails against several RFCs
friendsofphp/proxy-manager-lts           v1.0.5       Adding support for a wider range of PHP versions to ocramius/proxy-manager
friendsofsymfony/ckeditor-bundle         2.3.0        Provides a CKEditor integration for your Symfony project.
gedmo/doctrine-extensions                v3.4.0       Doctrine2 behavioral extensions
imagine/imagine                          1.2.4        Image processing for PHP 5.3
jms/metadata                             2.6.1        Class/method/property metadata management in PHP
jms/serializer                           3.16.0       Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
knplabs/gaufrette                        v0.10.0      PHP library that provides a filesystem abstraction layer
knplabs/knp-menu                         v3.3.0       An object oriented menu library
knplabs/knp-menu-bundle                  v3.2.0       This bundle provides an integration of the KnpMenu library
laminas/laminas-code                     4.5.0        Extensions to the PHP Reflection API, static code scanning, and code generation
liip/imagine-bundle                      2.7.3        This bundle provides an image manipulation abstraction toolkit for Symfony-based projects.
monolog/monolog                          2.3.5        Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy                        1.10.2       Create deep copies (clones) of your objects
nikic/php-parser                         v4.13.2      A PHP parser written in PHP
nyholm/psr7                              1.4.1        A fast PHP7 implementation of PSR-7
phar-io/manifest                         2.0.3        Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                          3.1.0        Library for handling version information and constraints
php-http/message-factory                 v1.0.2       Factory interfaces for PSR-7 HTTP Message
phpdocumentor/reflection-common          2.2.0        Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock        5.3.0        With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a Do...
phpdocumentor/type-resolver              1.5.1        A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy                         v1.15.0      Highly opinionated mocking framework for PHP 5.3+
phpstan/phpdoc-parser                    1.2.0        PHPDoc parser with support for nullable, intersection and generic types
phpunit/php-code-coverage                9.2.10       Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator                3.0.6        FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                      3.1.1        Invoke callables with a timeout
phpunit/php-text-template                2.0.4        Simple template engine.
phpunit/php-timer                        5.0.3        Utility class for timing
phpunit/phpunit                          9.5.10       The PHP Unit Testing framework.
psr/cache                                2.0.0        Common interface for caching libraries
psr/container                            1.1.2        Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                     1.0.0        Standard interfaces for event handling.
psr/http-client                          1.0.1        Common interface for HTTP clients
psr/http-factory                         1.0.1        Common interfaces for PSR-7 HTTP message factories
psr/http-message                         1.0.1        Common interface for HTTP messages
psr/link                                 1.1.1        Common interfaces for HTTP links
psr/log                                  2.0.0        Common interface for logging libraries
sebastian/cli-parser                     1.0.1        Library for parsing CLI options
sebastian/code-unit                      1.0.8        Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup       2.0.3        Looks up which function or method a line of code belongs to
sebastian/comparator                     4.0.6        Provides the functionality to compare PHP values for equality
sebastian/complexity                     2.0.2        Library for calculating the complexity of PHP code units
sebastian/diff                           4.0.4        Diff implementation
sebastian/environment                    5.1.3        Provides functionality to handle HHVM/PHP environments
sebastian/exporter                       4.0.4        Provides the functionality to export PHP variables for visualization
sebastian/global-state                   5.0.3        Snapshotting of global state
sebastian/lines-of-code                  1.0.3        Library for counting the lines of code in PHP source code
sebastian/object-enumerator              4.0.4        Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector               2.0.4        Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context              4.0.4        Provides functionality to recursively process PHP variables
sebastian/resource-operations            3.0.3        Provides a list of PHP built-in functions that operate on resources
sebastian/type                           2.3.4        Collection of value objects that represent the types of the PHP type system
sebastian/version                        3.0.2        Library that helps with managing the version number of Git-hosted PHP projects
sensio/framework-extra-bundle            v6.2.1       This bundle provides a way to configure your controllers with annotations
sonata-project/admin-bundle              4.5.0        The missing Symfony Admin Generator
sonata-project/block-bundle              4.9.0        Symfony SonataBlockBundle
sonata-project/cache                     2.2.0        Cache library
sonata-project/doctrine-extensions       1.16.0       Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 4.2.1        Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.9.1        Lightweight Exporter library
sonata-project/form-extensions           1.12.4       Symfony form extensions
sonata-project/media-bundle              4.0.0-alpha1 Symfony SonataMediaBundle
sonata-project/twig-extensions           1.9.1        Sonata twig extensions
stof/doctrine-extensions-bundle          v1.7.0       Integration of the gedmo/doctrine-extensions with Symfony
swiftmailer/swiftmailer                  v6.3.0       Swiftmailer, free feature-rich PHP mailer
symfony/amqp-messenger                   v5.4.0       Symfony AMQP extension Messenger Bridge
symfony/asset                            v5.4.0       Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/browser-kit                      v5.4.0       Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/cache                            v5.4.0       Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts                  v2.5.0       Generic abstractions related to caching
symfony/config                           v5.4.0       Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                          v5.4.0       Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                     v5.4.0       Converts CSS selectors to XPath expressions
symfony/debug-bundle                     v5.4.0       Provides a tight integration of the Symfony Debug component into the Symfony full-stack framework
symfony/dependency-injection             v5.4.1       Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts            v3.0.0       A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge                  v5.4.1       Provides integration for Doctrine with various Symfony components
symfony/doctrine-messenger               v5.4.0       Symfony Doctrine Messenger Bridge
symfony/dom-crawler                      v5.4.0       Eases DOM navigation for HTML and XML documents
symfony/dotenv                           v5.4.0       Registers environment variables from a .env file
symfony/error-handler                    v5.4.1       Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                 v5.4.0       Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts       v2.5.0       Generic abstractions related to dispatching event
symfony/expression-language              v5.4.0       Provides an engine that can compile and evaluate expressions
symfony/filesystem                       v5.4.0       Provides basic utilities for the filesystem
symfony/finder                           v5.4.0       Finds files and directories via an intuitive fluent interface
symfony/flex                             v1.17.6      Composer plugin for Symfony
symfony/form                             v5.4.0       Allows to easily create, process and reuse HTML forms
symfony/framework-bundle                 v5.4.0       Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                      v5.4.0       Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts            v2.5.0       Generic abstractions related to HTTP clients
symfony/http-foundation                  v5.4.1       Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                      v5.4.0       Provides a structured process for converting a Request into a Response
symfony/intl                             v5.4.0       Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library
symfony/mailer                           v5.4.0       Helps sending emails
symfony/maker-bundle                     v1.36.4      Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/messenger                        v5.4.0       Helps applications send and receive messages to/from other applications or via message queues
symfony/mime                             v5.4.0       Allows manipulating MIME messages
symfony/monolog-bridge                   v5.4.0       Provides integration for Monolog with various Symfony components
symfony/monolog-bundle                   v3.7.1       Symfony MonologBundle
symfony/notifier                         v5.4.0       Sends notifications via one or more channels (email, SMS, ...)
symfony/options-resolver                 v5.4.0       Provides an improved replacement for the array_replace PHP function
symfony/password-hasher                  v5.4.0       Provides password hashing utilities
symfony/phpunit-bridge                   v5.4.0       Provides utilities for PHPUnit, especially user deprecation notices management
symfony/polyfill-intl-grapheme           v1.23.1      Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu                v1.23.0      Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn                v1.23.0      Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer         v1.23.0      Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                v1.23.1      Symfony polyfill for the Mbstring extension
symfony/polyfill-php73                   v1.23.0      Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80                   v1.23.1      Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81                   v1.23.0      Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/polyfill-uuid                    v1.23.0      Symfony polyfill for uuid functions
symfony/process                          v5.4.0       Executes commands in sub-processes
symfony/property-access                  v5.4.0       Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info                    v5.4.0       Extracts information about PHP class' properties using metadata of popular sources
symfony/proxy-manager-bridge             v5.4.0       Provides integration for ProxyManager with various Symfony components
symfony/redis-messenger                  v5.4.0       Symfony Redis extension Messenger Bridge
symfony/routing                          v5.4.0       Maps an HTTP request to a set of configuration variables
symfony/runtime                          v5.4.0       Enables decoupling PHP applications from global state
symfony/security-acl                     v3.2.0       Symfony Security Component - ACL (Access Control List)
symfony/security-bundle                  v5.4.0       Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core                    v5.4.0       Symfony Security Component - Core Library
symfony/security-csrf                    v5.4.0       Symfony Security Component - CSRF Library
symfony/security-guard                   v5.4.0       Symfony Security Component - Guard
symfony/security-http                    v5.4.0       Symfony Security Component - HTTP Integration
symfony/serializer                       v5.4.0       Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/service-contracts                v2.4.1       Generic abstractions related to writing services
symfony/stopwatch                        v5.4.0       Provides a way to profile code
symfony/string                           v5.4.0       Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/swiftmailer-bundle               v3.5.3       Symfony SwiftmailerBundle
symfony/translation                      v5.4.0       Provides tools to internationalize your application
symfony/translation-contracts            v2.5.0       Generic abstractions related to translation
symfony/twig-bridge                      v5.4.0       Provides integration for Twig with various Symfony components
symfony/twig-bundle                      v5.4.0       Provides a tight integration of Twig into the Symfony full-stack framework
symfony/uid                              v5.4.0       Provides an object-oriented API to generate and represent UIDs
symfony/ux-chartjs                       v1.3.0       Chart.js integration for Symfony
symfony/validator                        v5.4.0       Provides tools to validate values
symfony/var-dumper                       v5.4.1       Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                     v5.4.0       Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-link                         v5.4.0       Manages links between resources
symfony/web-profiler-bundle              v5.4.0       Provides a development tool that gives detailed information about the execution of any request
symfony/webpack-encore-bundle            v1.13.2      Integration with your Symfony app & Webpack Encore!
symfony/yaml                             v5.4.0       Loads and dumps YAML files
theseer/tokenizer                        1.2.1        A small library for converting tokenized PHP source code into XML and potentially other formats
twig/extra-bundle                        v3.3.4       A Symfony bundle for extra Twig extensions
twig/string-extra                        v3.3.4       A Twig extension for Symfony String
twig/twig                                v3.3.4       Twig, the flexible, fast, and secure template language for PHP
vich/uploader-bundle                     1.18.0       Ease file uploads attached to entities
webmozart/assert                         1.10.0       Assertions to validate method input/output with nice error messages.
VincentLanglet commented 2 years ago

This is the diff https://github.com/sonata-project/SonataMediaBundle/compare/4.0.0-alpha1...4.0.0-RC1

jordisala1991 commented 2 years ago

Have you tried with 4.x-dev?

dima-gr commented 2 years ago

i just tried it today, the problem is still present, I'll try to fix it in a week or two

lukepass commented 2 years ago

Today I experienced the same problem, it seems that the proxy is not able to load the full entity.

I made a temporary fix using fetch: 'EAGER' but it's not a permanent solution.

Thanks.

haivala commented 2 years ago

I made own entity which has relation: entity [1:M] gallery ->galleryItem -> media

I had to add fetch: eager in my entity to load even the gallery. after that galleryItem worked but not the relation to the media.

jordisala1991 commented 2 years ago

Might be related to: https://github.com/sonata-project/SonataMediaBundle/pull/2263

Im facing similar problem but when I do deletes on my entities. Not sure how to reproduce or how to fix it tho. Im still investigating on my free time which is not much, any help is welcome.

jordisala1991 commented 2 years ago

Can you test with #2264 ?

lukepass commented 2 years ago

Thanks jordi, I will test it right away. How can i modify my composer.json in order to be able to install that PR?

Now the version is like this:

"sonata-project/media-bundle": "4.0.0-RC2",

Thanks.

jordisala1991 commented 2 years ago

https://getcomposer.org/doc/05-repositories.md#vcs

You can configure my fork of SonataMediaBundle and use this branch in order to test the PR.

lukepass commented 2 years ago

I am getting this error:

composer update sonata-project/media-bundle

  [UnexpectedValueException]                                                        
  Could not parse version constraint improvement/remove-final-modifier: Invalid ve  
  rsion string "improvement/remove-final-modifier"                                  

update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-autoloader] [--no-scripts] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
"sonata-project/media-bundle": "improvement/remove-final-modifier",
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/jordisala1991/SonataMediaBundle"
        }
    ]
jordisala1991 commented 2 years ago

I guess it should be:

"sonata-project/media-bundle": "dev-improvement/remove-final-modifier",

lukepass commented 2 years ago

Thanks Jordi, this solves 2 bugs:

1) The one in the subject of this issue 2) Another bug I discovered when deleting a media using batch delete*

Again, thanks a lot for your work. If this can be merged into 4.x I will upgrade ASAP.

*In case you wondered what bug was it, this is the error:

image

jordisala1991 commented 2 years ago

Yes, the second one is the one I was facing also. Thanks for testing!

lukepass commented 2 years ago

Thanks! Is it possible to get a new release for 4.x?

jordisala1991 commented 2 years ago

For now please use 4.x-dev. I have one more problem to fix.

lukepass commented 2 years ago

@jordisala1991 I am happy to say that this solves a third bug I was experiencing! A ManyToMany relationship didn't work for SonataMediaMedia elements, now it's working correctly!

image