Looks like my solution was to change the various instances of:
$categories_name_exists = false;
To an empty array:
Code:
$categories_name_exists = array(); // used for backwards compatibility
$categories_name_exists = []; // accomplishes the same as above via shortened code
Worked in PHP 8.2.9 for me. I had just come up with another idea, but it required writing more code.