Skip to content

Two InputfieldButtons rendered in form causes PHP out of memory error #653

@Toutouwai

Description

@Toutouwai

Short description of the issue

After the v3.0.109 update there seems to be an issue when two buttons are rendered in a form. In the forums Zeka noticed that an out of memory error occurs when trying to access ProcessDatabaseBackups: https://processwire.com/talk/topic/19730-allowed-memery-size-exausted-db-backups-module/

I could reproduce this and traced it back to the presence of two button inputfields in ProcessDatabaseBackups::execute().

Here is a simple test module that demonstrates the issue:

<?php namespace ProcessWire;

class ProcessTest extends Process {

    public static function getModuleInfo() {
        return array(
            'title' => 'Process Test',
            'version' => 1,
            'page' => array(
                'name' => 'test',
                'parent' => 'setup',
                'title' => 'Test',
            ),
        );
    }

    public function ___execute() {

        $form = $this->modules->get('InputfieldForm');

        $f = $this->modules->get('InputfieldButton');
        $f->value = 'foo';
        $form->add($f);

        $f = $this->modules->get('InputfieldButton');
        $f->value = 'bar';
        $form->add($f);

        return $form->render();

    }

}

Error is:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in ...\wire\core\WireArray.php on line 693 Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Setup/Environment

  • ProcessWire version: 3.0.109
  • (Optional) PHP version: 7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions