Skip to content

Exception: Serialization of 'Closure' is not allowed #100

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

Open
patriziotomato opened this issue Feb 10, 2025 · 4 comments
Open

Exception: Serialization of 'Closure' is not allowed #100

patriziotomato opened this issue Feb 10, 2025 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@patriziotomato
Copy link
Contributor

If you need to serialize an DTO, or an object where an DTO is embedded, you will get a

Exception: Serialization of 'Closure' is not allowed

as Validation logic contains Closures, that cannot get serialized.

@patriziotomato
Copy link
Contributor Author

patriziotomato commented Feb 10, 2025

Proposal to fix it: #101

patriziotomato added a commit to patriziotomato/laravel-validated-dto that referenced this issue Feb 10, 2025
@WendellAdriel WendellAdriel added the bug Something isn't working label Feb 11, 2025
@WendellAdriel
Copy link
Owner

Hey @patriziotomato
Thanks a lot, I'll check the PR

@patriziotomato
Copy link
Contributor Author

Any idea why I get this, while using make test ?

   FAILED  Tests\Unit\ValidatedDTOTest > it validates that ValidatedDTO can be instantiated with file validation rules                                                                               LogicException   
  GD extension is not installed.

@WendellAdriel
Copy link
Owner

Hey @patriziotomato
That's weird, I didn't face this before.
But you can try adding this to the Dockerfile, although I'm not 100% sure this is still the correct way of installing the extension on the PHP Alpine image 😅

# Install system dependencies
RUN apk add --no-cache --update \
    curl \
    openssl \
    libpng-dev \
    libjpeg-turbo-dev \
    freetype-dev \
    libzip-dev \
    unzip

# Install the GD extension 
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install gd

If it doesn't work, let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants