Skip to content

Pageimage::debugInfo always return first value when querying multiple variations #920

@horst-n

Description

@horst-n

Short description of the issue

Pageimage::debugInfo always returns the value from the first queried variation, when querying multiple variations.

Expected behavior

It should return the value of the current queried image variation.

Actual behavior

When querying multiple different variations, it return the value from the first one every time.

Optional: Suggestion for a possible fix

In Pageimage.php on line 424, remove if(!$this->pageimageDebugInfo), so that always a new instance with the actual variation is created!

Steps to reproduce the issue

  1. Step 1
    Run the following code in a template file:
    $image = $page->images->first();
    echo "<pre>";
    echo $image->getDebugInfo([], 'object')->files->basename ."\n";
    echo $image->width(200)->getDebugInfo([], 'object')->files->basename ."\n";
    echo $image->width(120)->getDebugInfo([], 'object')->files->basename ."\n";
    echo "</pre>";
  1. Step 2
    Manipulate the wire/core/Pageimage.php file with the above suggested fix, and run the template code again.

Setup/Environment

  • ProcessWire version: >= 3.0.132

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