Skip to content

Memory limit not throw new RuntimeException #856

@Triloworld

Description

@Triloworld

This line by default use limited memory:

$resource = imagecreatetruecolor($size->getWidth(), $size->getHeight());

What I get:

  • PHP Error hidden in production application

What we like to get:

  • throw error on screen that memory isn't sufficient

This fix temporary to use all machine memory if application setup is less than needed:

        $memory = ini_get('memory_limit');
        ini_set('memory_limit', '-1');
        $resource = imagecreatetruecolor($size->getWidth(), $size->getHeight());
        ini_set('memory_limit', $memory);

There is solution that throw error when memory size isn't enought:
https://www.php.net/manual/en/function.imagecreatetruecolor.php#99623

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions