Bug
On PHP 8.x, the following warning is thrown whenever renderHTML() iterates over a field that no longer exists in the database (e.g. a field that was deleted after version-control data was recorded for it):
Warning: Attempt to read property "type" on null in .../modules/VersionControl/ProcessVersionControl.module:668
Affected line
ProcessVersionControl.module, line 668:
if ($diff && wire('fields')->get($field)->type instanceof FieldtypeFile) $diff = "";
wire('fields')->get($field) returns null when the field no longer exists. PHP 7 silently ignored the property access on null; PHP 8 emits a warning (and depending on error_reporting, can break page output).
Environment
- ProcessWire: 3.0.255
- VersionControl: 1.3.5
- PHP: 8.4
Proposed fix
Add a null-guard before accessing ->type:
if ($diff && ($f = wire('fields')->get($field)) && $f->type instanceof FieldtypeFile) $diff = "";
One-line change, no behaviour change — simply skips the FieldtypeFile check when the field no longer exists in ProcessWire.
Bug
On PHP 8.x, the following warning is thrown whenever
renderHTML()iterates over a field that no longer exists in the database (e.g. a field that was deleted after version-control data was recorded for it):Affected line
ProcessVersionControl.module, line 668:wire('fields')->get($field)returnsnullwhen the field no longer exists. PHP 7 silently ignored the property access on null; PHP 8 emits a warning (and depending onerror_reporting, can break page output).Environment
Proposed fix
Add a null-guard before accessing
->type:One-line change, no behaviour change — simply skips the
FieldtypeFilecheck when the field no longer exists in ProcessWire.