Page MenuHomePhorge

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

Authored by Sten on Jul 17 2023, 12:56.

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