Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preload() corrupts getChanges() #2004

Open
tuomassalo opened this issue Nov 29, 2024 · 1 comment
Open

preload() corrupts getChanges() #2004

tuomassalo opened this issue Nov 29, 2024 · 1 comment

Comments

@tuomassalo
Copy link

Short description of the issue

Using preload(['foo')] will set foo as changed.

Expected behavior

preload should not affect getChanges().

Steps to reproduce the issue

Add a template with a non-autojoined field firstname. Create a page with a firstname field. Run this:

$p = $pages->get(1234);
echo("Changes before preload: " . json_encode($p->getChanges()) . "\n");
$p->preload(['firstname']); // fetches firstname
echo("Changes after preload: " . json_encode($p->getChanges()) . "\n");

This incorrectly results in:

Changes before preload: []
Changes after preload: ["firstname"]

I would expect $p->preload(['firstname']) to and $p->get('firstname') do the same thing: fetch the value from DB but not set the field as changed.

Setup/Environment

  • ProcessWire version: latest dev
ryancramerdesign added a commit to processwire/processwire that referenced this issue Nov 29, 2024
@ryancramerdesign
Copy link
Member

Thanks @tuomassalo I've pushed a fix for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants