Page MenuHomePhorge

Fix PHP 8.1 trim(null) exception in ./bin/diviner generate
ClosedPublic

Authored by Sten on Jul 17 2023, 12:56.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 8, 13:26
Unknown Object (File)
Mon, Apr 1, 03:18
Unknown Object (File)
Mon, Apr 1, 02:27
Unknown Object (File)
Sun, Mar 31, 16:05
Unknown Object (File)
Sun, Mar 31, 14:49
Unknown Object (File)
Sun, Mar 31, 02:04
Unknown Object (File)
Fri, Mar 29, 19:00
Unknown Object (File)
Fri, Mar 29, 03:49

Details

Summary

When running './bin/diviner generate' under PHP 8.1, we get a trim(null) exception.

Fixes T15548

Test Plan

Run './bin/diviner generate'

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Sten requested review of this revision.Jul 17 2023, 12:56
avivey added inline comments.
src/applications/diviner/atom/DivinerAtom.php
349

idx-with-default

src/applications/diviner/atom/DivinerAtom.php
349

In idx we have:

if ($default === null || array_key_exists($key, $array)) {
  return null;
}

And as the key is set, idx returns null even if we specify a non-null default.

Hence coalesce works, idx with default fails.

Gentle reminder that this has been waiting review for a while now...

avivey added inline comments.
src/applications/diviner/atom/DivinerAtom.php
349

ha. I never realized that!

This revision is now accepted and ready to land.Aug 11 2023, 07:00