Skip to content

image field cuases error when limit set to 1 #961

@gideonso

Description

@gideonso

Short description of the issue

When a image field limited set to 1, when upload another image to the field in a page, error occurs

Recoverable Fatal Error: Argument 1 passed to ProcessWire\Pageimage::setOriginal() must be an instance of ProcessWire\Pageimage, null given, called in /home/web/processwire/WireCore-3.0/core/PageimageVariations.php on line 257 and defined (line 1334 of /home/web/processwire/WireCore-3.0/core/Pageimage.php)

Expected behavior

Page save without any error

Actual behavior

Database record of the image not deleted.

Optional: Screenshots/Links that demonstrate the issue

backend_image_field_screenshot png 5114f59ba9ef3b4c94036de3e427ac7b

Steps to reproduce the issue

  1. Create an image field and set limit to 1. The assign it to a tempate.
  2. edit a page with that tempage
  3. upload a image to the image field and click save.
  4. upload another image to the field and click save.
  5. Error shown

Setup/Environment

PHP 5.6
MariaDB 10
ProcessWire 3.0.137

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions