Based on a reading of the empty's manual page and comments (Ctrl-F for isset and/or double underscores), it looks like this is known behavior, and if you want your set and get methods and empty to play nice together, there's an implicit assumption that you implement a __isset magic method as well.
empty($filter->primary)
is not working as expected, same applies for classes with magic propertiesSolution:
https://stackoverflow.com/questions/2045791/php-empty-on-get-accessor