Skip to content

Failing to create a PNG object from string #30

@klaari

Description

@klaari

The Image::fromString method fails when processing PNG files due to infinite recursion.
The method attempts to call PNG::fromString($string) to create a PNG object. However, the PNG class does not implement its own fromString method and inherits from the Image class. This absence leads to infinite recursion, which will continue until the PHP memory limit is exhausted.

Error message

Fatal error: Allowed memory size of ... bytes exhausted (tried to allocate ... bytes) in ... 

Steps to Reproduce:

Warning: will exhaust all memory assigned to PHP

use CSD\Image\Image; $string = \file_get_contents(__DIR__ . '/Fixtures/nometa.png'); $image = Image::fromString($string); 

I will submit a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions