We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
When a Decimal field is preloaded, a stored integer value is returned with trailing .00. Without preloading, the value does not have .00.
.00
Preloading should not affect the result, only performance.
$page->preload() causes the field value to show with trailing .00. With non-integer values, preloading does not affect the output.
$page->preload()
See script below. Output:
Without preload: "42" With preload: "42.00"
Mysql 8.0.39
<?php $processwirePath = '/var/www/html/'; include($processwirePath . 'index.php'); header('Content-Type: text/plain'); // Remove field $field = $fields->get('d'); if ($field) $fields->delete($field); $template = $templates->get('name=home'); $dField = $fields->makeItem(); $dField->name = 'd'; $dField->type = 'Decimal'; $dField->save(); $template->fields->add($dField); $template->save(); $p1 = $wire->pages->get(1); $p1->d = 42; $p1->save(); $wire->pages->uncacheAll(); $p1 = $wire->pages->get(1); echo "Without preload: " . json_encode($p1->d) . "\n"; $wire->pages->uncacheAll(); $p1 = $wire->pages->get(1); $p1->preload(['d']); echo "With preload: " . json_encode($p1->d) . "\n";
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Short description of the issue
When a Decimal field is preloaded, a stored integer value is returned with trailing
.00
. Without preloading, the value does not have.00
.Expected behavior
Preloading should not affect the result, only performance.
Actual behavior
$page->preload()
causes the field value to show with trailing.00
. With non-integer values, preloading does not affect the output.Steps to reproduce the issue
See script below. Output:
Setup/Environment
Mysql 8.0.39
The script:
The text was updated successfully, but these errors were encountered: