@awilfox some other comments:
we actually want to get rid of basename() use, and converted most uses over to our own path_extract_filename() (which is a bit more careful with the corner cases, and returns proper errors). If you port over the rest, we'd happily merge that and your basename incompat goes away.