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, Sep 21, 08:56
Unknown Object (File)
Wed, Aug 30, 05:31
Unknown Object (File)
Wed, Aug 30, 01:41
Unknown Object (File)
Tue, Aug 29, 20:19
Unknown Object (File)
Tue, Aug 29, 13:29
Unknown Object (File)
Fri, Aug 25, 18:54
Unknown Object (File)
Aug 9 2023, 20:07
Unknown Object (File)
Aug 9 2023, 00:47

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