PHP 7.3: Warning on undefined variable names passed to compact


compact function, that is used to create an array from a given list of variable names, now emits a PHP notice if it encounters an undefined variable.

Prior to PHP 7.3, undefined variables were simply ignored:

compact('foo', 'bar');

From PHP 7.3 and later, compact function emits a PHP notice when it encounters an undefined variable:

compact('foo', 'bar');
Notice: compact(): Undefined variable: foo in ... on line ...
Notice: compact(): Undefined variable: bar ... on line ...

Related Changes