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)
Thu, Jul 25, 09:50
Unknown Object (File)
Mon, Jul 22, 14:10
Unknown Object (File)
Mon, Jul 22, 14:10
Unknown Object (File)
Mon, Jul 22, 14:03
Unknown Object (File)
Sun, Jul 21, 16:59
Unknown Object (File)
Sun, Jul 14, 22:19
Unknown Object (File)
Sun, Jul 14, 01:12
Unknown Object (File)
Sat, Jul 13, 11:57

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